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