0

I have two java projects:

  • MainProject
  • LibraryProject

I use Maven to build my MainProject. In pom.xml of MainProject, I defined the dependency of LibraryProject:

<dependency>
    <groupId>com.xxx.LibraryProject</groupId>
    <artifactId>LibraryProject</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <type>jar</type>
</dependency>

Under MainProject root path, after I run : maven clean install a MainProject.jar is generated. But those classes defined in LibraryProject & invoked by MainProject are not available in this MainProject.jar.

How can I have the LibraryProject classes available in the MainProject.jar ?

I have tried Maven Assembly Plugin , but it doesn't work for me. I need the dependency be included in the MainProject.jar

Mellon
  • 37,586
  • 78
  • 186
  • 264
  • "I have tried Maven Assembly Plugin , but it doesn't work for me" ... why not? That's exactly what it does. – Brian Roach Jan 09 '14 at 19:30
  • @PaulProgrammer, I have read the link you provided, but after did that & execute command "mvn clean compile assembly:single" , I didn't see the generated MainProject.jar, but if I do "mvn clean install" it is generated, the LibraryProject's classes are still not available – Mellon Jan 09 '14 at 19:31
  • @Mellon then you didn't set up the `` section – Brian Roach Jan 09 '14 at 19:34
  • @Brian Roach, could you please provide a sample ? – Mellon Jan 09 '14 at 19:37
  • @mellon The sample in the A to linked Q should work perfectly fine. I use it to provide a .jar including all the dependencies for the Riak Java client, [pom.xml is here](https://github.com/basho/riak-java-client/blob/1.4.4/pom.xml#L376) (it's in its own profile, but that doesn't change the config) – Brian Roach Jan 09 '14 at 19:52

0 Answers0