使用jboss-as-maven-plugin插件来发布项目到Jboss7。
pom.xml中新增:
<build> <!-- Maven will append the version to the finalName (which is the name given to the generated war, and hence the context root) --> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>${version.war.plugin}</version> <configuration> <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! --> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> <!-- The JBoss AS plugin deploys your war to a local JBoss AS container --> <!-- To use, run: mvn package jboss-as:deploy --> <plugin> <groupId>org.jboss.as.plugins</groupId> <artifactId>jboss-as-maven-plugin</artifactId> <version>${version.jboss.maven.plugin}</version> </plugin> </plugins> </build>
使用mvn clean package jboss-as:deploy来打包部署发布。
jboss-as:deploy 是将应用发布到一个运行的Jboss容器中(注意:要先启动jboss,才可以发布成功)