This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven - ClassNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven - ClassNotFoundException" Watch "Maven - ClassNotFoundException" New topic
Author

Maven - ClassNotFoundException

Graeme Byers
Ranch Hand

Joined: Apr 16, 2004
Posts: 127
This may be a simple Java ClassNotFoundException rather than Maven but I can't spot it.

Thank you for any help.

I'm following 'Maven - The Definitive Guide' page 54.

Step 1 :



Step 2 :



Step 3 :


Step 4 :





Graeme Byers
Ranch Hand

Joined: Apr 16, 2004
Posts: 127
Forgot to mention : %CLASSPATH% contains C:\ch-custom\simple-weather\target\classes
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

You are using the Exec plugin. You need to post the entire definition of that plugin from your pom.xml file (Maven - The Definitive Guide, page 54, doesn't show the Exec plugin being used). Apparently, you didn't set the classpath, or you used the wrong target (you should be using exec:java, not exec:exec).

Also, "The Definitive Guide" has be superceeded by "The Complete Reference": http://www.sonatype.com/books/mvnref-book/reference/


JBoss In Action
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Graeme Byers wrote:Forgot to mention : %CLASSPATH% contains C:\ch-custom\simple-weather\target\classes

Never set CLASSPATH, that's a sure way to get yourself into trouble because you will at some point accidentally pick up the wrong class file. Besides, you should not have to do that when using Maven.
 
Consider Paul's rocket mass heater.
 
subject: Maven - ClassNotFoundException
 
Similar Threads
maven set up
linking my own application jar file to my maven build.
Maven error: Failed to collect dependencies
Could not resolve dependencies for maven project
maven java:compile