jhsuwm / onejar-maven-plugin

Automatically exported from code.google.com/p/onejar-maven-plugin
0 stars 0 forks source link

Other project dependencies seem to not be added into one-jar #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Execute my one-jar.
2. Project class dependency is not found.

java.lang.NoClassDefFoundError: 
RMB/CreditData/CreditDownload$MarkitIndexFamily
        at RMB.CreditConsole.Program.DownloadXML(Program.java:68)
        at RMB.CreditConsole.Program.main(Program.java:401)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.simontuffs.onejar.Boot.run(Boot.java:306)
        at com.simontuffs.onejar.Boot.main(Boot.java:159)

What is the expected output? What do you see instead?
My other maven projects that are included in the pom as a dependency are 
not included within the one-jar. Only my external jars are included. The 
error above occurs even though I have that specific project added as a 
dependency.

What version of the product are you using? On what operating system?
I am using version 1.4.1 with Windows 200 OS.

Please provide any additional information below.
Attached is my pom file.

Original issue reported on code.google.com by Elisha.N...@gmail.com on 2 Jun 2009 at 9:34

Attachments:

GoogleCodeExporter commented 9 years ago
I had the same problem when packaging with the Maven m2 plugin for Eclipse. 
However,
when performing a 'mvn package' from command line, there was no problem and the 
jars
are included as expected.

Original comment by tom.w.p....@gmail.com on 4 Jun 2009 at 6:30

GoogleCodeExporter commented 9 years ago
Hi Elisha, thanks for your issue report. And thank you Tom for your input on 
the matter.

I made a small test project which I beleive does the same thing you are looking 
for,
Elisha.

It's three library projects, and one application project. All
<packaging>jar</packaging> and the app uses onejar-maven-plugin. They are built 
from
a root-pom which has all of them as <module>.

You can download it from here:
http://github.com/hugojosefson/onejar-maven-plugin-issue15/tree/master

Unpack, enter the unpacked directory and run these commands and you should get 
the
correct output:

$ mvn install
$ java -jar myapp/target/myapp-1.0-SNAPSHOT.one-jar.jar 
Hello World from App!
Hello World from Lib A!
Hello World from Lib B!
Hello World from Lib C!

I use Maven 2.0.10.

Elisha, please verify if it works for you with a recent version of Maven.

Switching issue status to Incomplete, while waiting for your response. Thank 
you.

/Hugo

Original comment by hugo.josefson.old@gmail.com on 12 Jun 2009 at 7:33

GoogleCodeExporter commented 9 years ago
Hi, Hugo.

Thanks for the working example. 

The strange thing is that it only works from command line. (as my project did)

When I package from within Eclipse with the Maven m2 Eclipse plugin there is no 
lib
folder included in myapp-1.0-SNAPSHOT.one-jar.jar, resulting in a 
NoClassDefFoundError.

Thanks,

Tom.

Original comment by tom.w.p....@gmail.com on 13 Jun 2009 at 11:00

GoogleCodeExporter commented 9 years ago
Thank you Elisha for verifying that.

Yes, many people have problems with Eclipe's instability. That's why I always
recommend clients to rely on a stable build tool (like Maven) for building and
releasing, and only use an IDE as far as it makes certain things easier (like
CTRL-space completion and stuff). I even use a different IDE 
altogether...combined
with Maven of course!

/Hugo
----
Closing this now as WontFix, because it works with Maven as it should.

Original comment by hugo.josefson.old@gmail.com on 13 Jun 2009 at 11:16

GoogleCodeExporter commented 9 years ago
Sorry Tom and Elisha! Mixed up your names there a little.. :)

Original comment by hugo.josefson.old@gmail.com on 13 Jun 2009 at 11:17