I'm trying to "mavenize" a simple console application that is a module
of a larger maven project. I developed the app in eclipse and am now
moving into the maven project.
The app imports one jar file used to process command line parameters
(argparser.jar). The jar file is installed in the .m2 repository on
the local machine.
I'm able to compile and package the jar file, but when I try to run
it, I get a java.lan.NoClassDefFoundError, even when I specify the
path to the jar using -claspath.
This console app is a module of a larger maven project. The top level
pom.xml file includes this:
Top level pom.xml:
<modules>
<module>common</module>
<module>servlet</module>
<module>console</module>
</modules>
The pom.xml for the console module specifies a dependency for the
argparser jar:
<dependency>
<groupId>argparser</groupId>
<artifactId>argparser</artifactId>
<version>1.0</version>
</dependency>
And it exists in my .m2 repository.
I can compile and package the project, but can't run it because of the
NoClassDefFoundError.
I can run the console app only if I remove any references to the
argparser classes in the code.
I've been reading throught the Better Builds with Maven and googling
quite a bit on this, but am missing something.
Thanks in advance.
Ed
Build Example:
mvn clean compile package -o
mvn clean compile package -o
[INFO]
NOTE: Maven is executing in offline mode. Any artifacts not already in
your local
repository will be inaccessible.
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] Comcast - SeaDAC - Parent
[INFO] Comcast - SeaDAC - Common Module
[INFO] Comcast - SeaDAC - Servlet Module
[INFO] Comcast - SeaDAC - Console Module
[INFO]
----------------------------------------------------------------------------
[INFO] Building Comcast - SeaDAC - Parent
[INFO] task-segment: [clean, compile, package]
[INFO]
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\src\workspace\seadac-10-2\target
[INFO] Deleting directory C:\src\workspace\seadac-10-2\target\classes
[INFO] Deleting directory C:\src\workspace\seadac-10-2\target\test-classes
[INFO] No goals needed for project - skipping
[INFO] [site:attach-descriptor]
[INFO]
----------------------------------------------------------------------------
[INFO] Building Comcast - SeaDAC - Common Module
[INFO] task-segment: [clean, compile, package]
[INFO]
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\src\workspace\seadac-10-2\common\target
[INFO] Deleting directory C:\src\workspace\seadac-10-2\common\target\classes
[INFO] Deleting directory
C:\src\workspace\seadac-10-2\common\target\test-classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[WARNING] While downloading xerces:xerces:2.4.0
This artifact has been relocated to xerces:xercesImpl:2.4.0.
[INFO] [compiler:compile]
Compiling 18 source files to C:\src\workspace\seadac-10-2\common\target\classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] Building jar:
C:\src\workspace\seadac-10-2\common\target\comcast-seadac-common-1.0-SNAPSHOT.jar
[INFO]
----------------------------------------------------------------------------
[INFO] Building Comcast - SeaDAC - Servlet Module
[INFO] task-segment: [clean, compile, package]
[INFO]
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\src\workspace\seadac-10-2\servlet\target
[INFO] Deleting directory C:\src\workspace\seadac-10-2\servlet\target\classes
[INFO] Deleting directory
C:\src\workspace\seadac-10-2\servlet\target\test-classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 1 source file to C:\src\workspace\seadac-10-2\servlet\target\classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] Building jar:
C:\src\workspace\seadac-10-2\servlet\target\comcast-seadac-servlet-1.0-SNAPSHOT.jar
[INFO]
----------------------------------------------------------------------------
[INFO] Building Comcast - SeaDAC - Console Module
[INFO] task-segment: [clean, compile, package]
[INFO]
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\src\workspace\seadac-10-2\console\target
[INFO] Deleting directory C:\src\workspace\seadac-10-2\console\target\classes
[INFO] Deleting directory
C:\src\workspace\seadac-10-2\console\target\test-classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 1 source file to C:\src\workspace\seadac-10-2\console\target\classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] Building jar:
C:\src\workspace\seadac-10-2\console\target\comcast-seadac-console-1.0-SNAPSHOT.jar
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Comcast - SeaDAC - Parent ............................. SUCCESS [2.469s]
[INFO] Comcast - SeaDAC - Common Module ...................... SUCCESS [3.125s]
[INFO] Comcast - SeaDAC - Servlet Module ..................... SUCCESS [1.172s]
[INFO] Comcast - SeaDAC - Console Module ..................... SUCCESS [2.141s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Mon Oct 16 10:16:29 MDT 2006
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
java -cp "c:/Documents and
Settings/eyoung2297c/.m2/repository/argparser/argparser/1.0" -jar
console/target/comcast-seadac-console-1.0-SNAPSHOT.jar
sea DAC Console APP
Exception in thread "main" java.lang.NoClassDefFoundError:
argparser/StringHolder
at com.comcast.seadac.console.ConsoleApp.main(ConsoleApp.java:55)
--
Ed
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]