Using Jenkins CI to build Spigot

Discussion in 'Spigot Plugin Development' started by TheExoduser, May 5, 2015.

  1. Hey there,

    First of all, I'm not sure if this is the right section to post this question, so if it's wrong please move it to the right one.

    Now my problem. I'm using Jenkins CI to continuously build my private Spigot plugins. As a matter of fact Jenkins always needs the right Spigot version to build my plugins. Therefore I would like my Jenkins to always fetch the newest builds from hub.spigotmc.org and compile them for me.
    So far I've got it working that Jenkins is fetching all commits from the Git server of spigot and tries to compile them, but (and thats the problem) he is always failing to compile Spigot because he can't find/build the Spigot child modules. Here the exact error message (open the Spoiler to see it):
    Started by an SCM change
    Building in workspace C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace
    > git.exe rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
    > git.exe config remote.origin.url https://hub.spigotmc.org/stash/scm/spigot/spigot.git # timeout=10
    Fetching upstream changes from https://hub.spigotmc.org/stash/scm/spigot/spigot.git
    > git.exe --version # timeout=10
    > git.exe -c core.askpass=true fetch --tags --progress https://hub.spigotmc.org/stash/scm/spigot/spigot.git +refs/heads/*:refs/remotes/origin/*
    > git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
    > git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
    Checking out Revision 870264a3f84d88d6d50e9e71849a50ebac0d9ddd (refs/remotes/origin/master)
    > git.exe config core.sparsecheckout # timeout=10
    > git.exe checkout -f 870264a3f84d88d6d50e9e71849a50ebac0d9ddd
    > git.exe rev-list 2ec6f06d354112dea058ff44ee7c713a4a760fba # timeout=10
    Parsing POMs
    ERROR: Failed to parse POMs
    org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
    [ERROR] Child module C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\Spigot-Server of C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\pom.xml does not exist @
    [ERROR] Child module C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\Spigot-API of C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\pom.xml does not exist @

    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364)
    at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:361)
    at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:331)
    at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1300)
    at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1097)
    at hudson.FilePath.act(FilePath.java:991)
    at hudson.FilePath.act(FilePath.java:969)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:959)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:679)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
    at hudson.model.Run.execute(Run.java:1744)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)
    Archiving artifacts
    Finished: FAILURE

    As you can see Jenkins can't find the child modules of Spigot... but well I don't know what to do now.
    Is there a possibility that Jenkins could fetch or build the child modules, too?

    Any help would be really much appreciated!
     
  2. Afaik you cant build spigot without using buildtools.. So jenkins wont be able to build it for you. Correct me if im wrong tho ! :p
     
  3. Indeed buildtools is needed to correctly compile spigot, however jenkins is more than capable of running a jar.

    The way I have it configured is as a freestyle project with the only build step being an execute shell statement running
    Code (Text):
    curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && java -jar BuildTools.jar
    The '-z' parameter in curl is to be a little more friendly to the spigot servers by checking if the file is newer than the current before downloading it.

    - flamin
     
  4. Ah cool. Thanks I didn't knew that I could execute jar files with Jenkins. I've configured it now with your provided information and it's working like a charm :)
     

  5. Well I've tried that. At first it worked perfectly, but now I'm getting this annoying error
    Starting download of https://s3.amazonaws.com/Minecraft.Download/versions/1.8.3/minecraft_server.1.8.3.jar

    Downloaded file: work\minecraft_server.1.8.3.jar with md5: cdd49c262cb98db636b8fae2837869ef
    Final mapped jar: work\mapped.73f3c166.jar does not exist, creating!

    Loading mappings
    1 packages, 0 classes, 0 fields, 0 methods
    Remapping final jar

    [INFO] Scanning for projects...
    [ERROR] The build could not read 1 project -> [Help 1]
    [ERROR]
    [ERROR] The project org.spigotmc:spigot-parent:dev-SNAPSHOT (C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\pom.xml) has 2 errors
    [ERROR] Child module C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\Spigot-Server of C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\pom.xml does not exist
    [ERROR] Child module C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\Spigot-API of C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\pom.xml does not exist
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
    Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [sh, C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace\apache-maven-3.2.3/bin/mvn, install:install-file, -Dfile=work\mapped.73f3c166.jar, -Dpackaging=jar, -DgroupId=org.spigotmc, -DartifactId=minecraft-server, -Dversion=1.8.3-SNAPSHOT]
    at org.spigotmc.builder.Builder.runProcess(Builder.java:492)
    at org.spigotmc.builder.Builder.main(Builder.java:278)

    C:\Program Files (x86)\Jenkins\jobs\SpigotMC\workspace>exit 1
    Build step 'Execute Windows batch command' marked build as failure
    Archiving artifacts
    Recording fingerprints
    Finished: FAILURE

    If i run the BuildTools with the cmd/powershell it executes without a problem.
    Note: As you might have recognized I'm using a windows server system, could this cause problems with jenkins or the buildtools?