3

我想将我的战争上传到两个单独的位置。为此,我在 pom.xml 中定义了以下配置文件;

   ........
    <profile>
    <id>deployPoc</id>
    <activation>
        <activeByDefault>false</activeByDefault>
    </activation>
    <properties>
        <jboss.host>POC_Deploy</jboss.host>
        <jboss.deployDir>/storage2/home/server1/</jboss.deployDir>
        <jboss.deployUrl>scp://server1.com</jboss.deployUrl>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-upload-plugin</artifactId>
                <version>1.1</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.wagon</groupId>
                        <artifactId>wagon-ssh</artifactId>
                        <version>2.4</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <resourceSrc>
                        ${project.build.directory}/${project.build.finalName}.${project.packaging}
                    </resourceSrc>
                    <resourceDest>${jboss.deployDir}</resourceDest>
                    <serverId>${jboss.host}</serverId>
                    <url>${jboss.deployUrl}</url>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>
<profile>
    <id>uploadUpdate</id>
    <activation>
        <activeByDefault>false</activeByDefault>
    </activation>
    <properties>
        <updateReleaseHost>PluginReleaseSite</updateReleaseHost>
        <updateReleaseDir>/var/www/html/releases/Latest/</updateReleaseDir>
        <updateReleaseUrl>scp://server2.com</updateReleaseUrl>
    </properties>
    <build>
        <plugins>
            <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-upload-plugin</artifactId>
            <version>1.1</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.wagon</groupId>
                    <artifactId>wagon-ssh</artifactId>
                    <version>2.4</version>
                </dependency>
            </dependencies>
            <configuration>
                <resourceSrc>
                    ${project.build.directory}/${project.build.finalName}.${project.packaging}
                </resourceSrc>
                <resourceDest>${updateReleaseDir}</resourceDest>
                <serverId>${updateReleaseHost}</serverId>
                <url>${updateReleaseUrl}</url>
            </configuration>
          </plugin>
    </plugins>
  </build>
</profile>

我正在尝试使用以下命令执行两者,并且只执行其中一个;

mvn help:active-profiles upload:upload -PdeployPoc -PuploadUpdate

它只执行'uploadUpdate',我已经尝试了一切,即-Pa,b; -P a,b 等

尽管 maven 显示以下内容,但似乎没有任何效果;

The following profiles are active:

 - releaseRepository (source: external)
 - snapshotsRepository (source: external)
 - deployPoc (source: com.Project:1.0-SNAPSHOT)
 - uploadUpdate (source: com.Project:1.0-SNAPSHOT)

我错过了什么吗?

谢谢,

--

SJunejo

4

1 回答 1

5

根据配置文件,您使用的是相同的插件,这意味着您具有相同的执行,这意味着相同的执行 ID,在您的情况下是相同的。

我建议使用具有不同 ID 的显式执行。

除了上述之外,我建议使用jboss 插件部署到应用程序服务器,这不是 Maven 的预期方法。

于 2013-05-22T17:58:04.643 回答