Maven ist ein Build-System für komplexe Projekte.

Artifact manuell installieren#

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

Artifact deployen#

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

Glassfish deployen#

Command line:
mvn glassfish:deploy
Plugin 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>

JBoss deployen#

Command line:
mvn jboss:redeploy
Plugin 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>

Exec 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

Manual ant task#

	<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