View Source



h1.Table Of Contents

{TOC}


h1.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.


h2.Samples


{noformat}$ mvn confluence-reporting:deploy@maven-experience
{noformat}

[Refer to stackoverflow|http://stackoverflow.com/a/28778436/521197|]


h1.Deploy Artifact from CLI without need of declare {{<distributionManagement>}} in pom.xml


{noformat}$ mvn deploy -DaltDeploymentRepository=id::layout::url
{noformat}

*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|


h1.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

{noformat}$ mvn enforcer:display-info
{noformat}

For further information click [here|http://maven.apache.org/plugins/maven-enforcer-plugin/rules/requireOS.html|]


h1.How to: set a local repositories in the command line

The example below specifies custom local repository.

{noformat}$ mvn package -Dmaven.repo.local=~/test/repo
{noformat}

The example below specifies two remote repositories and a custom local repository.

{noformat}$ mvn package -Dmaven.repo.remote=http://www.ibiblio.org/maven/,http://myrepo -Dmaven.repo.local=~/test/repo
{noformat}

refer to [stackoverflow|http://stackoverflow.com/a/1193664/521197|]


h1.References

||Topic ||Link||
|Maven Build Profiles |http://maven.apache.org/guides/introduction/introduction-to-profiles.html|


h1.MAVEN 2 (OBSOLETE)



h2.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.

{noformat}export MAVEN_OPTS=”-Xmx512m”
{noformat}

*Note maven 2.0.6*

{quote}
note than Maven 2.0.6 onwards some users have reported that the double quotes give problems, hence you might want to use

{noformat}export MAVEN_OPTS=-Xmx512m
{noformat}


{quote}


h2.Tomcat plugin in debug mode


bq. Since Tomcat runs in the same process as Maven, it is enough add the debug opts to MAVEN_OPTS (see below)


{noformat}
MAVEN_OPTS=-Xdebug \
-Xnoagent \
-Djava.compiler=NONE \
-Xrunjdwp:transport=dt_socket,address=3998,suspend=n,server=y \
-Xms256m \
-Xmx512m \
-XX:MaxPermSize=128m \

{noformat}

*Eclipse:*

{quote}
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


{quote}