stuff22
stuff22

Reputation: 1672

Jar with compiled class files in different directories with Maven

I have a java project with multiple source directories. I use the build-helper-maven-plugin to compile them. Layout as follows:

project
      |
      |-src-
      |    |-com/example1-
      |                  |-Test.java
      |
      |-src2   
      |    |-META-INF
      |             |-classes
      |             |       |-com/example2
      |             |                    |-Test2.java
      |             |
      |             |-Manifest.mf 
      |
      |-MavenDependencies      

For reasons I care not to explain right now, I need to produce a jar file looking something like this.

jar-
   |-com/example1-
   |            |-Test.java
   |
   |-META-INF
            |-classes
            |       |-com/example2
            |                    |-Test2.java
            |
            |-Manifest.mf
            |
            |-lib

I know there must some plugin that can be used to achieve this, just can't seem to find it.

Upvotes: 0

Views: 110

Answers (1)

MattSenter
MattSenter

Reputation: 3120

I believe you are looking for the "Maven Assembly Plugin": http://maven.apache.org/plugins/maven-assembly-plugin/

Since it seems you are building a non-standard jar, the assembly plugin will allow you to put whichever files you want wherever you want them to go.

Upvotes: 2

Related Questions