1.16.5 Create maven repo from github repo

Discussion in 'Spigot Plugin Development' started by punisher5, Jul 5, 2021.

  1. Hi, i'm starting an API and I would like to host it on my github repo for a maven use.

    I followed this tuto but I'm getting this error:
    Code (Text):
    Failed to execute goal com.github.github:site-maven-plugin:0.11:site (default) on project BaseAPI: Error retrieving user info: Not Found (404)
    It says that I didn't give the correct name for my github repo but as you can see here there are corrects.

    Here is my pom.xml
    Code (Text):
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <groupId>net.johnpoliakov</groupId>
        <artifactId>BaseAPI</artifactId>
        <version>1.0-RELEASE</version>
        <packaging>jar</packaging>

        <name>BaseAPI</name>

        <properties>
            <java.version>11</java.version>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <github.global.server>github</github.global.server>
        </properties>

        <distributionManagement>
            <repository>
                <id>internal.repo</id>
                <name>Temporary Staging Repository</name>
                <url>file://${project.build.directory}/mvn-repo</url>
            </repository>
        </distributionManagement>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.2.4</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <createDependencyReducedPom>false</createDependencyReducedPom>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                    <configuration>
                        <altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.github.github</groupId>
                    <artifactId>site-maven-plugin</artifactId>
                    <version>0.11</version>
                    <configuration>
                        <message>Maven artifacts for ${project.version}</message> <!-- git commit message -->
                        <noJekyll>true</noJekyll>  <!-- disable webpage processing -->
                        <outputDirectory>${project.build.directory}/mvn-repo</outputDirectory> <!-- matches distribution management repository url above -->
                        <branch>refs/heads/mvn-repo</branch> <!-- remote branch name -->
                        <includes><include>**/*</include></includes>
                        <repositoryName>BaseAPI</repositoryName> <!-- github repo name -->
                        <repositoryOwner>JohnPoliakov</repositoryOwner> <!-- organization or user name  -->
                    </configuration>
                    <executions> <!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->
                        <execution>
                            <goals>
                                <goal>site</goal>
                            </goals>
                            <phase>deploy</phase>
                        </execution>
                    </executions>
                </plugin>

            </plugins>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                </resource>
            </resources>
        </build>

        <repositories>
            <repository>
                <id>spigotmc-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
            </repository>
            <repository>
                <id>sonatype</id>
                <url>https://oss.sonatype.org/content/groups/public/</url>
            </repository>
        </repositories>

        <dependencies>
            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot-api</artifactId>
                <version>1.16.5-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </project>
     
    yes my credentials are corrects in the settings.xml

    PS: sorry I know it's not really a Spigot problem but it actually blocks my plugins projects ¯\_(ツ)_/¯
     
  2. What exactly are you trying to accomplish? From what I can see you are trying to use your BaseAPI as a dependency in another project? If so you'll have to create an artifact and host that. You can look into this: https://gist.github.com/cleberjamaral/6c9b0a615e51e26c94ffe407a641f531 which allows you to store jars on Github and use github as your own maven repository for dependencies.
     
    • Like Like x 1
  3. Indeed I would like to use it as a maven dependency, someone actually said me something like you on the Spigot discord, I didn't test it yet but I will soon.