User Tools

Site Tools


maven

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
maven [2014/03/04 09:18]
mihael
maven [2016/05/27 09:39] (current)
mihael [Skip Unit test]
Line 1: Line 1:
 ====== Maven ====== ====== Maven ======
 +
 +===== Update Parent POM Version in Modules =====
 +If the project structure is the following:
 +<​code>​
 + ​Parent POM
 +     +
 +     |
 +     ​+--->​ Module 1
 +     |
 +     ​+--->​ Module 2
 +     |
 +     ​+--->​ Module 3
 +</​code>​
 +
 +and the modules inherit the version from the parent pom then it is a PITA to update all modules with the new parent pom version when the parent pom version is incremented.
 +
 +An easy way for this is the following command which will update the parent pom version in the modules with the version in the parent pom project.
 +
 +  mvn -N versions:​update-child-modules
 +
 +<note tip>By default this command will generate a backup version of each updated pom. To drop the generation of backups add the parameter ''​generateBackupPoms=false''​ to the maven command.</​note>​
 +
 +Found on [[http://​www.mojohaus.org/​versions-maven-plugin/​examples/​update-child-modules.html|Mojohaus.org]].
 +
 +===== Manifest.merge Error in Eclipse =====
 +
 +  org.codehaus.plexus.archiver.jar.Manifest.merge(org.codehaus.plexus.archiver.jar.Manifest)
 +  ​
 +This error only occurs in Eclipse. The Eclipse Plugin for the Maven Archiver needs to be updated with this update site:
 +
 +  http://​repo1.maven.org/​maven2/​.m2e/​connectors/​m2eclipse-mavenarchiver/​0.17.0/​N/​LATEST/​
 +
 +See http://​stackoverflow.com/​questions/​28351678/​org-codehaus-plexus-archiver-jar-manifest-mergeorg-codehaus-plexus-archiver-jar
 +  ​
 +  ​
 +===== Copy Maven Artifact on Build =====
 +<sxh xml;title: pom.xml>
 +<​build>​
 + <​plugins>​
 + <​plugin>​
 + <​groupId>​org.codehaus.mojo</​groupId>​
 + <​artifactId>​wagon-maven-plugin</​artifactId>​
 + <​version>​1.0-beta-5</​version>​
 + <​executions>​
 + <​execution>​
 + <​id>​upload-jar-to-folder</​id>​
 + <​phase>​deploy</​phase>​
 + <​goals>​
 + <​goal>​upload</​goal>​
 + </​goals>​
 + </​execution>​
 + </​executions>​
 + <​configuration>​
 + <​fromDir>​${project.build.directory}</​fromDir>​
 + <​includes>​${project.build.finalName}.${project.packaging}</​includes>​
 + <​url>​file:///​opt/​karaf</​url>​
 + <​toDir>​deploy</​toDir>​
 + </​configuration>​
 + </​plugin>​
 + </​plugins>​
 +</​build>​
 +</​sxh>​
  
 ===== Add 3rd Party Library ===== ===== Add 3rd Party Library =====
Line 11: Line 73:
     -Dpackaging=jar     -Dpackaging=jar
 </​code>​ </​code>​
 +
 +===== Skip Unit test =====
 +
 +Use the Java property ''​-Dmaven.test.skip=true''​ to skip unit tests.
  
 ===== Embed Dependencies ===== ===== Embed Dependencies =====
Line 17: Line 83:
   <​Embed-Dependency>​*;​scope=compile</​Embed-Dependency>​   <​Embed-Dependency>​*;​scope=compile</​Embed-Dependency>​
  
-Damit alle transitiven (nicht direkten) Abhängigkeiten auch eingebettet werden muss folgende Anweisung benutzt werden:+To embed all transitive dependencies the following configuration must be added to the pom.xml:
  
   <​Embed-Transitive>​true</​Embed-Transitive>​   <​Embed-Transitive>​true</​Embed-Transitive>​
  
-Das Maven Bundle Plugin ​sorgt dafür, dass die eingebetteten Java Bibliotheken in dem OSGi Bundle landen und passt das Manifest an (Bundle-ClassPath).+The Maven Bundle Plugin ​embeds all configured dependencies and adjusts the Bundle-ClassPath ​in the Manifest file.
  
-== Beispiel ​==+==== Example ====
 <sxh xml> <sxh xml>
   <​build>​   <​build>​
maven.1393924692.txt.gz · Last modified: 2014/03/04 09:18 by mihael