java - Maven package with source and attached dependecies -


i'm having hard time adding java source files , attached dependencies output jar file using maven.

what want archive having compiled classes, source files , dependencies (without sources) in 1 jar can distributed.

- com/name/project/*.class - com/name/project/*.java - lib/*.jar - meta-inf/manifest.mf   

here pom.xml have far:

 <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-dependency-plugin</artifactid>             <version>2.7</version>             <executions>                 <execution>                     <id>copy-dependencies</id>                     <phase>package</phase>                     <goals>                         <goal>copy-dependencies</goal>                     </goals>                     <configuration>                         <outputdirectory>${project.build.directory}/lib</outputdirectory>                         <overwritereleases>false</overwritereleases>                         <overwritesnapshots>false</overwritesnapshots>                         <overwriteifnewer>true</overwriteifnewer>                     </configuration>                 </execution>             </executions>         </plugin>         <plugin>             <artifactid>maven-jar-plugin</artifactid>             <configuration>                 <archive>                     <manifest>                         <addclasspath>true</addclasspath>                         <classpathprefix>lib/</classpathprefix>                         <mainclass>com.name.project/main</mainclass>                     </manifest>                 </archive>             </configuration>         </plugin> 

i hope can me.

cheers dan

a jar shouldn't contain other jars, of course there's nothing prevent doing that.

you can include source code neatly using resource section follows:

<build>     </resources>         <resource>             <directory>src/main/java</directory>         </resource>     </resources>     ... 

i'd venture guess might able bind copy-dependencies task resources phase , see if include dependency jars in final artifact.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -