I would like to upload my war onto two sepearet locations. For that I have defined following profile in my 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>

I am trying to execute both using following command and its only executing one of them;

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

Its only executing 'uploadUpdate', I have tried everything i.e. -Pa,b; -P a,b etc etc.

Nothing seems to be working though maven shows following;

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)

Am I missing something?

Thanks,

--

SJunejo

有帮助吗?

解决方案

Based on the profiles you are using the same plugin which means you have the same executions which means the same execution id which is the same in your case.

I would suggest to use explicit executions with different Id's.

Apart from the above I would suggest to use the jboss plugin to deploy to an application server which is not the intended approach of Maven.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top