Skip to content

Commit cb56aa3

Browse files
committed
Enable packaging of jar with dependencies.
1 parent 1783a88 commit cb56aa3

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

pom.xml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,61 @@
105105
<source>1.7</source>
106106
<target>1.7</target>
107107
</configuration>
108-
109108
</plugin>
110109

110+
<!-- Copy the dependency jars into the target/dependency directory -->
111+
<plugin>
112+
<groupId>org.apache.maven.plugins</groupId>
113+
<artifactId>maven-dependency-plugin</artifactId>
114+
<executions>
115+
<execution>
116+
<id>copy</id>
117+
<phase>compile</phase>
118+
<goals>
119+
<goal>copy-dependencies</goal>
120+
</goals>
121+
</execution>
122+
</executions>
123+
</plugin>
124+
125+
<!-- Add the manifest file to the jar and force classpath to the dependency directory to automatically include the dependency jars-->
126+
<plugin>
127+
<groupId>org.apache.maven.plugins</groupId>
128+
<artifactId>maven-jar-plugin</artifactId>
129+
<configuration>
130+
<archive>
131+
<manifest>
132+
<addClasspath>true</addClasspath>
133+
<mainClass>org.restflow.RestFlow</mainClass>
134+
<!-- <classpathPrefix>dependency/</classpathPrefix>-->
135+
</manifest>
136+
</archive>
137+
</configuration>
138+
</plugin>
139+
140+
<!-- Make a standalone jar file -->
141+
<plugin>
142+
<artifactId>maven-assembly-plugin</artifactId>
143+
<configuration>
144+
<archive>
145+
<manifest>
146+
<mainClass>org.restflow.RestFlow</mainClass>
147+
</manifest>
148+
</archive>
149+
<descriptorRefs>
150+
<descriptorRef>jar-with-dependencies</descriptorRef>
151+
</descriptorRefs>
152+
</configuration>
153+
<executions>
154+
<execution>
155+
<phase>package</phase>
156+
<goals>
157+
<goal>single</goal>
158+
</goals>
159+
</execution>
160+
</executions>
161+
</plugin>
162+
111163
</plugins>
112164
</build>
113165

0 commit comments

Comments
 (0)