Table Of Contents
Run a single Maven plugin execution
From maven 3.3.1 it is possible direct exec a from CLI a single plugin execution. It is enough add @<execution id> to the goal name where <execution id> must be configured in your pom.
Samples
$ mvn confluence-reporting:deploy@maven-experience
Deploy Artifact from CLI without need of declare <distributionManagement> in pom.xml
$ mvn deploy -DaltDeploymentRepository=id::layout::url
where
param | description |
---|---|
id | Repository id. The id can be used to pick up the correct credentials from the settings.xml |
layout | default |
url | The location of the repository |
How to detect operative system to associate at maven profile
To change build process depends over operative system we could use maven activation features. To display the system info detected from maven use the command below
$ mvn enforcer:display-info
For further information click here
How to: set a local repositories in the command line
The example below specifies custom local repository.
$ mvn package -Dmaven.repo.local=~/test/repo
The example below specifies two remote repositories and a custom local repository.
$ mvn package -Dmaven.repo.remote=http://www.ibiblio.org/maven/,http://myrepo -Dmaven.repo.local=~/test/repo
refer to stackoverflow
References
Topic | Link |
---|---|
Maven Build Profiles | http://maven.apache.org/guides/introduction/introduction-to-profiles.html |
MAVEN 2 (OBSOLETE)
How to increase the Java heap memory for Maven 2 on linux
If you get an error OutOfMemory error while doing mvn site, because of all the reports that you are generating, just increase the heap size for maven2. The way to do that on linux.
In your mvn.sh add this as the first line after the copyright and other comments.
export MAVEN_OPTS=”-Xmx512m”
Note maven 2.0.6
note than Maven 2.0.6 onwards some users have reported that the double quotes give problems, hence you might want to use
export MAVEN_OPTS=-Xmx512m
Tomcat plugin in debug mode
Since Tomcat runs in the same process as Maven, it is enough add the debug opts to MAVEN_OPTS (see below)
MAVEN_OPTS=-Xdebug \ -Xnoagent \ -Djava.compiler=NONE \ -Xrunjdwp:transport=dt_socket,address=3998,suspend=n,server=y \ -Xms256m \ -Xmx512m \ -XX:MaxPermSize=128m \
Eclipse:
To set this options in eclipse IDE you have to follow the steps below:
- select from menu Debug -> Debug Configuration
- Create a new Maven Build and set as goal tomcat:run
- select tab JRE and put options in VM arguments text area