Skip to content

Instantly share code, notes, and snippets.

@jgeek
Last active September 27, 2015 07:49
Show Gist options
  • Save jgeek/0467abad8b94eeb245e6 to your computer and use it in GitHub Desktop.
Save jgeek/0467abad8b94eeb245e6 to your computer and use it in GitHub Desktop.
maven commands
#define profile and build upon it:
<modules>
<module>module1</module>
<module>module2</module>
...
</modules>
...
<profiles>
<profile>
<id>ci</id>
<modules>
<module>module1</module>
<module>module2</module>
...
<module>module-integration-test</module>
</modules>
</profile>
</profiles>
$ mvn -P ci clean install
# build selected modules:
$ mvn -pl module1,module2 clean install
# exclude some module from build
$ mvn pl !moudle1,!module2 clean install
# install local file to local maven repository
$ mvn install:install-file -Dfile=bootstrap-1.0.10.jar -DgroupId=org.primefaces.themes -DartifactId=bootstrap -Dversion=1 .0.10 -Dpackaging=jar
# deploy local file to maven repository
$ mvn deploy:deploy-file -Dfile=bootstrap-1.0.10.jar -DgroupId=org.primefaces.themes -DartifactId=bootstrap -Dversion=1 .0.10 -Dpackaging=jar -Durl=http://maven:8080/nexus/content/repositories/central/
# see configs used by maven
$ mvn help:effective-settings
$ mvn -X
# package and run project
mvn package exec:java -Dexec.mainClass=sample.MianClass
# assembly plugin to make executable jar
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
$mvn clean compile assembly:single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment