I'm having a hard time adding java source files and the attached dependencies to an output jar file using maven.
What I want to archive is having the compiled classes, the source files and all dependencies (without sources) in one jar which can be distributed.
- com/name/project/*.class
- com/name/project/*.java
- lib/*.jar
- META-INF/MANIFEST.MF
Here is the pom.xml what I have so 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 anyone can help me.
cheers dan