如何让Maven将我的项目部署到远程JBoss AS7服务器

时间:2013-01-18 00:39:28

标签: java maven jboss jboss7.x

如果我执行

,如何让Maven将我的项目部署到远程JBoss AS7服务器

mvn install

但如果我做了

,我希望它部署到我的本地JBoss AS7服务器

mvn jboss-as:deploy

下面是我的POM.XML文件:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.xxxx</groupId>
    <artifactId>MavenJbossWebDemo</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>Maven and JBoss WebDemo Webapp</name>
    <url>http://maven.apache.org</url>



    <properties>
        <java-version>1.7</java-version>
        <deploy.jboss.host>xxx</deploy.jboss.host>
        <deploy.jboss.user>xx</deploy.jboss.user>
        <deploy.jboss.password>xx</deploy.jboss.password>
    </properties>


    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>MavenJbossWebDemo</finalName>

        <plugins>
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>7.2.Final</version>
            </plugin>

            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>7.2.Final</version>
                <configuration>
                    <hostname>${deploy.jboss.host}</hostname>
                    <port>${deploy.jboss.port}</port>
                    <username>${deploy.jboss.user}</username>
                    <password>${deploy.jboss.password}</password>
                    <name>${backend.deployment-name}</name>
                    <filename>${project.build.finalName}.war</filename>
                    <skip>${skipDeployment}</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>deploy-jar</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

0 个答案:

没有答案