Skip to content

Instantly share code, notes, and snippets.

@ShmuelMofrad
Last active November 29, 2017 19:52
Show Gist options
  • Save ShmuelMofrad/72bf0a06ff78228cdcea52b66c49bf83 to your computer and use it in GitHub Desktop.
Save ShmuelMofrad/72bf0a06ff78228cdcea52b66c49bf83 to your computer and use it in GitHub Desktop.
Maven - single project with dependencies.

Maven single project with dependencies.

build single project with dependencies

add this in your pom.xml

	<build>
		<sourceDirectory>src</sourceDirectory>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.7.0</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
							<mainClass>one.unus.run.examples.App</mainClass>
						</manifest>
					</archive>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
			</plugin>
		</plugins>
	</build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment