Maven Wagon plugin: Can a wagon: download a download in several places?

I am looking through the Maven Wagon Plugin to try to upload some artifacts to remote UNC servers ( \\servername\share\directory\to\put\to), and I have got it configured to work in POM:

<build>
  <extensions>
    <extension>
      <groupId>org.apache.maven.wagon</groupId>
      <artifactId>wagon-file</artifactId>
      <version>1.0-beta-7</version>
    </extension>
  </extensions>
<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>wagon-maven-plugin</artifactId>
    <version>1.0-beta-3</version>
    <executions>
      <execution>
        <id>upload-jar-to-folder</id>
        <phase>deploy</phase>
        <goals>
          <goal>upload</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <fromDir>${project.build.directory}</fromDir>
      <includes>*</includes>
      <url>file://localhost///${servername}/${sharename}</url>
      <toDir>directory/to/put/artifact</toDir>
    </configuration>
  </plugin>
  ...
</build>

This works fine for a single server in transit -Dservername=x -Dsharename=y, but how can I scale it so that I can run the deployment for QA or Prod, where I have multiple servers for deployment?

( ) script mvn wagon:upload -Penvironment# - , . script , script . ( Maven)...

<executions> ? , wagon:upload mvn deploy -Pqa?

+3
1

, : mvn deploy -Denv=qa .

http://maven.apache.org/guides/introduction/introduction-to-profiles.html

-Denvironment =

POM, maven-antrun-plugin :

 <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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.stackoverflow</groupId>
  <artifactId>q5328617</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <profiles>
    <profile>
        <activation>
            <property>
                <name>env</name>
                <value>qa</value>
            </property>
        </activation>
        <id>qa1</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <executions>
                      <execution>
                        <id>qa1</id>
                        <phase>test</phase>
                        <configuration>
                            <tasks>
                                <echo level="info">Executing qa1</echo>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                      </execution>
                    </executions>
                    <dependencies>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <activation>
            <property>
                <name>env</name>
                <value>qa</value>
            </property>
        </activation>
        <id>qa2</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <executions>
                      <execution>
                        <id>qa2</id>
                        <phase>test</phase>
                        <configuration>
                            <tasks>
                                <echo level="info">Executing qa2</echo>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                      </execution>
                    </executions>
                    <dependencies>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </profile>
  </profiles>
</project>
+3

Source: https://habr.com/ru/post/1778620/


All Articles