wakaleo / game-of-life

Demo application for the 'Jenkins: The Definitive Guide' book
http://www.wakaleo.com/books/jenkins-the-definitive-guide
2.03k stars 19.94k forks source link

game-of-life maven script not working - dependency failures #4

Open quux00 opened 13 years ago

quux00 commented 13 years ago

I am trying to go through chapter 2 of the Jenkins Definitive Guide book, but I am getting errors with the maven build. First, I am using java 1.6.0_22 and maven 3.0.3 on Ubuntu Linux. The maven builds fail both in Jenkins and when I run it on the command line directly. I have encountered two errors, one I worked around and another that I don't know how to fix. Currently, it is breaking when I run the javadoc:javadoc target. I don't know much about maven, so I'm needing help to progress with the book.

First problem - maven dependency errors for "clean package"

I won't copy the full error message as it is similar to the second problem, but it couldn't resolve dependencies having to do with com.wakaleo.gameoflife. When I looked at where it was trying to pull from, it looked like maybe you had changed the wakaleo maven url, so changing the pom.xml file to the text below fixed it ("mvn clean package" finally worked and all tests passed, etc.) .

<repositories>
  <repository>
    <id>wakaleo-releases</id>
    <name>Wakaleo Releases</name>
    <url>http://www.wakaleo.com/maven/repos/</url>
  </repository>
 <repository>
    <id>wakaleo-releases-2</id>
    <name>Wakaleo Releases 2</name>
    <url>http://maven.wakaleo.com/releases/</url>
 </repository>
</repositories>

Second problem - maven dependency errors for "javadoc:javadoc"

Using the same pom.xml above, I now cannot get the javadoc:javadoc target to build. Here is the error message: [INFO] >>> maven-javadoc-plugin:2.8:javadoc (default-cli) @ gameoflife-webservice >>> [INFO] [INFO] <<< maven-javadoc-plugin:2.8:javadoc (default-cli) @ gameoflife-webservice <<< [DEBUG] Could not find metadata com.wakaleo.gameoflife:gameoflife-core:0.7.47-SNAPSHOT/maven-metadata.xml in local (/home/midpeter444/.m2/repository) [DEBUG] com.wakaleo.gameoflife:gameoflife-webservice:jar:0.7.47-SNAPSHOT [DEBUG] com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT:compile [DEBUG] commons-lang:commons-lang:jar:2.5:compile [DEBUG] junit:junit:jar:4.8.2:test [DEBUG] org.hamcrest:hamcrest-all:jar:1.1:test [DEBUG] Could not find metadata com.wakaleo.gameoflife:gameoflife-core:0.7.47-SNAPSHOT/maven-metadata.xml in local (/home/midpeter444/.m2/repository) [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] gameoflife ........................................ SUCCESS [2.517s] [INFO] gameoflife-build .................................. SUCCESS [1.411s] [INFO] gameoflife-core ................................... SUCCESS [3.590s] [INFO] gameoflife-webservice ............................. FAILURE [1.391s] [INFO] gameoflife-web .................................... SKIPPED [INFO] gameoflife-cli .................................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.799s [INFO] Finished at: Fri Sep 09 18:33:04 EDT 2011 [INFO] Final Memory: 10M/125M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project gameoflife-webservice: Could not resolve dependencies for project com.wakaleo.gameoflife:gameoflife-webservice:jar:0.7.47-SNAPSHOT: Could not find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project gameoflife-webservice: Could not resolve dependencies for project com.wakaleo.gameoflife:gameoflife-webservice:jar:0.7.47-SNAPSHOT: Could not find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:196) at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:108) at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.wakaleo.gameoflife:gameoflife-webservice:jar:0.7.47-SNAPSHOT: Could not find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:170) at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:171) ... 22 more Caused by: org.sonatype.aether.resolution.DependencyResolutionException: Could not find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:412) at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:164) ... 23 more Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:541) at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:220) at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:395) ... 24 more Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:531) ... 26 more [ERROR]

wakaleo commented 13 years ago

Hi Michael,

Thanks for the update - I'll take a look on a fresh VMware instance this morning and sort it out.

Cheers,

John.

On 10 September 2011 10:41, Michael Peterson < reply@reply.github.com>wrote:

I am trying to go through chapter 2 of the Jenkins Definitive Guide book, but I am getting errors with the maven build. First, I am using java 1.6.0_22 and maven 3.0.3 on Ubuntu Linux. The maven builds fail both in Jenkins and when I run it on the command line directly. I have encountered two errors, one I worked around and another that I don't know how to fix. Currently, it is breaking when I run the javadoc:javadoc target. I don't know much about maven, so I'm needing help to progress with the book.

First problem - maven dependency errors for "clean package"

I won't copy the full error message as it is similar to the second problem, but it couldn't resolve dependencies having to do with com.wakaleo.gameoflife. When I looked at where it was trying to pull from, it looked like maybe you had changed the wakaleo maven url, so changing the pom.xml file to the text below fixed it ("mvn clean package" finally worked and all tests passed, etc.) .

 <repositories>
   <repository>
     <id>wakaleo-releases</id>
     <name>Wakaleo Releases</name>
     <url>http://www.wakaleo.com/maven/repos/</url>
   </repository>
  <repository>
     <id>wakaleo-releases-2</id>
     <name>Wakaleo Releases 2</name>
     <url>http://maven.wakaleo.com/releases/</url>
  </repository>
 </repositories>

Second problem - maven dependency errors for "javadoc:javadoc"

Using the same pom.xml above, I now cannot get the javadoc:javadoc target to build. Here is the error message:

[INFO] >>> maven-javadoc-plugin:2.8:javadoc (default-cli) @
gameoflife-webservice >>>
[INFO]
[INFO] <<< maven-javadoc-plugin:2.8:javadoc (default-cli) @
gameoflife-webservice <<<
[DEBUG] Could not find metadata
com.wakaleo.gameoflife:gameoflife-core:0.7.47-SNAPSHOT/maven-metadata.xml in
local (/home/midpeter444/.m2/repository)
[DEBUG] com.wakaleo.gameoflife:gameoflife-webservice:jar:0.7.47-SNAPSHOT
[DEBUG]
 com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT:compile
[DEBUG]    commons-lang:commons-lang:jar:2.5:compile
[DEBUG]    junit:junit:jar:4.8.2:test
[DEBUG]    org.hamcrest:hamcrest-all:jar:1.1:test
[DEBUG] Could not find metadata
com.wakaleo.gameoflife:gameoflife-core:0.7.47-SNAPSHOT/maven-metadata.xml in
local (/home/midpeter444/.m2/repository)
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] gameoflife ........................................ SUCCESS [2.517s]
[INFO] gameoflife-build .................................. SUCCESS [1.411s]
[INFO] gameoflife-core ................................... SUCCESS [3.590s]
[INFO] gameoflife-webservice ............................. FAILURE [1.391s]
[INFO] gameoflife-web .................................... SKIPPED
[INFO] gameoflife-cli .................................... SKIPPED
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 11.799s
[INFO] Finished at: Fri Sep 09 18:33:04 EDT 2011
[INFO] Final Memory: 10M/125M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal on project gameoflife-webservice: Could not
resolve dependencies for project
com.wakaleo.gameoflife:gameoflife-webservice:jar:0.7.47-SNAPSHOT: Could not
find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT ->
[Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal on project gameoflife-webservice: Could not resolve dependencies for
project com.wakaleo.gameoflife:gameoflife-webservice:jar:0.7.47-SNAPSHOT:
Could not find artifact
com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT
       at
org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:196)
       at
org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:108)
       at
org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
       at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
       at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
       at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
       at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
       at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
       at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
       at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
       at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
       at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
       at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:616)
       at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
       at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
       at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
       at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.project.DependencyResolutionException: Could
not resolve dependencies for project
com.wakaleo.gameoflife:gameoflife-webservice:jar:0.7.47-SNAPSHOT: Could not
find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT
       at
org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:170)
       at
org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:171)
       ... 22 more
Caused by: org.sonatype.aether.resolution.DependencyResolutionException:
Could not find artifact
com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT
       at
org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:412)
       at
org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:164)
       ... 23 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException:
Could not find artifact
com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT
       at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:541)
       at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:220)
       at
org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:395)
       ... 24 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could
not find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.7.47-SNAPSHOT
       at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:531)
       ... 26 more
[ERROR]

Reply to this email directly or view it on GitHub: https://github.com/wakaleo/game-of-life/issues/4


John Smart | Wakaleo Consulting | +64 21 032 2797 Optimizing your software development process http://www.wakaleo.com | john.smart@wakaleo.com

howardengelhart commented 13 years ago

Is there a resolution? I'm running into the same problem.

vcorr commented 12 years ago

yep, same problem here

gnustavo commented 12 years ago

Same problem here.

wakaleo commented 12 years ago

Should be fixed now on master

gnustavo commented 12 years ago

2012/3/3 John Ferguson Smart < reply@reply.github.com

Should be fixed now on master

Thanks. Lot's of errors went away when I pulled the changes.

However, the javadoc:javadoc tarted still doesn't work. I'm attaching the configuration and the files for a build in case you're willing to take a look at this.

Thank you, again.

Gustavo.

wakaleo commented 12 years ago

Hi,

I'm not getting any problems here with mvn javadoc:javadoc or with mvn site - what error are you getting exactly? Judging by the previous error, there might be an issue with your local Maven repository?

vador commented 12 years ago

I had this problem on a fresh debian install : when installing maven2, it pulls openjdk, and the javadoc:javadoc target fails.

What I did was

rjnienaber commented 12 years ago

Error

I'm running into the exact same issue as the original reporter. Here are the maven errors:

[ERROR] Failed to execute goal on project gameoflife-webservice: Could not resolve dependencies for project com.wakaleo.gameoflife:gameoflife-webservice:jar:0.9.65-SNAPSHOT: Could not find artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.9.65-SNAPSHOT -> [Help 1]

Here is the complete output.

Troubleshooting

Environment

$ lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 12.04 LTS Release: 12.04 Codename: precise

$ uname -a Linux richard-laptop 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ mvn --version Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.6.0_26, vendor: Sun Microsystems Inc. Java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre Default locale: en_GB, platform encoding: UTF-8 OS name: "linux", version: "3.2.0-27-generic", arch: "amd64", family: "unix"

epoupaert commented 12 years ago

I also had this javadoc:javadoc issue until I did a "mvn install".

Uriziel47 commented 12 years ago

Hi, I had a problem by calling "mvn javadoc:javadoc -o". I became a "NoPluginFoundForPrefixException". Until I tried: "mvn install" and then just "mvn javadoc:javadoc" (without flag -o!). Afterwards "mvn javadoc:javadoc -o" also worked without problems. (I dont know if "mvn install" was necessary.)

sreechok commented 11 years ago

Hi, I had the same problem when running the javadoc:javadoc command from the jenkins and also from the command line. I read through the comments but why should one need to run the mvn install? shouldn't the dependencies resolve automatically? Note: I am new to Maven so please excuse me for my limited knowledge.

sreechok commented 11 years ago

I ran "mvn install" then "mvn javadoc:javadoc" from command line which was ok but running the same again via jenkins gets the same error.

[ERROR] Failed to execute goal on project gameoflife-web: Could not resolve dependencies for project com.wakaleo.gameoflife:gameoflife-web:war:1.0.14: Could not find artifact com.wakaleo.gameoflife:gameoflife-core:jar:1.0.14 in central (http://repo.maven.apache.org/maven2) -> [Help 1]

Looks like something to do with the build number that jenkins uses. In the above error if you see that 14 (my previous build number) in 1.0.14 and my current build number was 15. If I ran again I gave me same error but with 1.0.15 error.

Any help on this would be much appreciated.

sreechok commented 11 years ago

I think I found the problem when running "mvn javadoc:javadoc" as I was running "clean package" from the jenkins. gameoflife-web has dependency on gameolife-core module so the newly created "gameoflife-core" module wasn't copied to the local repository when running just "clean package"; so when you run "clean install" which will clean, compile, test, package and also will install into the local repository and the above web component finds it dependency from local repository, without any errors.

m23leung commented 11 years ago

sreechok is correct, changing "clean package" to "clean install" fixed the problem for me with regards to the gameoflife-web error!! Thank youu!!

abbybader commented 10 years ago

I had the same problem, with an up-to-date version of the code, jenkins, and maven. I changed the first set of goals to "clean install package", and the job built without error. Further, I was able to change the goals back to "clean package", and the job builds without error. So the project has to be built at least once before the javadoc:javadoc goal will function.

epishan commented 10 years ago

thank you, sreechok! that fixed my problem as well.

majidkhorsandi commented 10 years ago

Hi,

I had the same exact problem with gameoflife-web and "clean install" instead of "clean package" helped to solve the problem.

Thanks sreechok

striker88 commented 10 years ago

Thanks sreechok. Changing maven build target from "clean package" to "clean install" fixed it.

nokhaizali commented 9 years ago

i also have same issue. in this site zscarymazegame.com can anyone solve.

mohdaliiqbal commented 9 years ago

that is true, this looks like an errata in the book, the Figure 2-25 shows "clean install" where as the first step asked to do "clean package". They should mention this change when explaining the javadoc:javadoc goal. May be wakaleo need to publish this in project's read me.

Another thing, do not put -o at the end of javadoc:javadoc goal as shown in Figure 2-25, this would make maven work offline and build will fail.

jiangao1 commented 8 years ago

Yes. I can confirm what mohdaliiqbal said above worked. All it takes is to change 'clean package' into 'clean install'. No need to change the pom or anything.

yxh601 commented 7 years ago

when i encounter the problem, the jenkins version is 2.53, while it still exist. Because of the book named Jenkins:The Definitive Guide shows "clean package", so i use it. when i added new build step to running "mvn javadoc:javadoc" , it appeared. Fortunately, i found the comment. Thanks everyone.