Maven ist ein Build-System für komplexe Projekte.
mvn install:install-file -DgroupId=com.intersult -DartifactId=com.intersult.skin -Dversion=1.0-SNAPSHOT -DgeneratePom=true -Dfile=com.intersult.skin-1.0-SNAPSHOT.jar -Dpackaging=jar
mvn deploy:deploy-file -DgroupId=com.intersult -DartifactId=com.intersult.skin -Dversion=1.0 -Dpackaging=jar -Dfile=target/com.intersult.skin-1.0-SNAPSHOT.jar -Durl=file://W:\deploy\repository.war -DrepositoryId=intersult-repository
C:\Java\workspace\import\agt-war>mvn -e deploy:deploy-file -DgroupId=ojdbc -DartifactId=ojdbc14 -Dversion=9.0.2.0.0 -Dpackaging=jar "-Dfile=C:\Java\lib\ojdbc14.jar" -DrepositoryId=intersult-repo -Durl=svn:https://intersult.com/svn/import/maven
Falls ein spezieller Wagon verwendet werden soll (Transportschicht für das Protocol-Handling), kann dieser und die Dependencies in <maven-home>/lib abgelegt werden (z.B. maven-svn-wagon-1.4.jar, svnkit-1.3.5.jar).
mvn glassfish:deployPlugin config:
<plugin> <groupId>org.glassfish.maven.plugin</groupId> <artifactId>maven-glassfish-plugin</artifactId> <version>2.1</version> <configuration> <domain> <name>domain1</name> <adminPort>4848</adminPort> </domain> <glassfishDirectory>${env.GLASSFISH_HOME}</glassfishDirectory> <user>admin</user> <adminPassword>adminadmin</adminPassword> <echo>true</echo> </configuration> </plugin>
mvn jboss:redeployPlugin config:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jboss-maven-plugin</artifactId> <version>1.4</version> <configuration> <hostName>localhost</hostName> <port>8080</port> <serverName>default</serverName> <fileNames> <fileName>${project.build.directory}/${project.build.finalName}.${project.packaging}</fileName> </fileNames> </configuration> </plugin>
<pluginRepository> <id>codehaus snapshot repository</id> <url>http://snapshots.repository.codehaus.org/</url> <releases> <enabled>true</enabled> </releases> </pluginRepository> ... <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>${env.GLASSFISH_HOME}/bin/asadmin</executable> <arguments> <argument>deploy</argument> <argument>target/test.war</argument> </arguments> </configuration> </plugin> mvn exec:exec
<profiles> <profile> <id>echo</id> <activation> <property> <name>command</name> <value>deploy</value> </property> </activation> <build> <defaultGoal>antrun:run</defaultGoal> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.3</version> <configuration> <tasks> <echo>Hello World!</echo> </tasks> </configuration> </plugin> </plugins> </build> </profile> </profiles> mvn -Dcommand=echo
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>compile</id> <phase>compile</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <echo message="${os.family}"/> <echo message="${os.arch}"/> </target> </configuration> </execution> </executions> </plugin>
Tests können so nicht debuggt werden, da für sie eine eigene VM erzeugt wird. Dies kann verhindert werden, indem das Surefire-Plugin konfiguriert wird:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.10</version> <configuration> <forkMode>never</forkMode> </configuration> </plugin>
Allerdings können sich dann Probleme mit dem Classpath ergeben.
<profile> <id>hudson</id> <activation> <property> <name>BUILD_NUMBER</name> </property> </activation> ... </profile>
<servers> <server> <id>intersult-repo</id> <username>username</username> <password>passwort</password> </server> </servers>