0

I have the following deploy profiles in my POM

<profile>
            <id>deployToProdOnRelease</id>
            <activation>
                <property>
                    <name>Maven.project.branch</name>
                    <value>release</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>upload_and_restart_service</id>
                                <phase>${cd_phase}</phase>
                                <configuration>
                                    //upload several files and restart service
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>commons-net</groupId>
                                <artifactId>commons-net</artifactId>
                                <version>1.4.1</version>
                            </dependency>
                            <dependency>
                                <groupId>ant</groupId>
                                <artifactId>ant-commons-net</artifactId>
                                <version>1.6.5</version>
                            </dependency>
                            <dependency>
                                <groupId>ant</groupId>
                                <artifactId>ant-jsch</artifactId>
                                <version>1.6.5</version>
                            </dependency>
                            <dependency>
                                <groupId>jsch</groupId>
                                <artifactId>jsch</artifactId>
                                <version>0.1.29</version>
                            </dependency>
                        </dependencies>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.3</version>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

I want to deploy the jar from the desktop on this server , what is teh maven command to achieve this?

If I run the following

mvn deploy -Dmaven.project.branch=release

It will pick up the deploy settings from settings.xml and deploy to the repository as well.

So instead can I run the ant tasks in some other phase ? Like install ? Would I just need to change the {cd_phase} to install? and just run mvn install?

user_mda
  • 18,148
  • 27
  • 82
  • 145
  • Set `cd_phase` to `install`? This is really unclear, what exactly are you trying to do here? And why deploy things at install? There is the `deploy` phase for that. – Tunaki Feb 07 '17 at 22:25
  • Right, I am looking for the command to deploy to the server using the profile. – user_mda Feb 08 '17 at 00:34
  • I guess what I was tryng to do was, have the CI system deploy at each release but having the option to deploy from desktop to the server. Using the deploy phase also deploys to the repository as set in settings.xml, so to by pass that having to deploy to the server – user_mda Feb 08 '17 at 00:46
  • So the problem is to activate that profile? `-DMaven.project.branch=release`? – Tunaki Feb 08 '17 at 07:55
  • and the command is mvn deploy -Dmaven.project.branch=release ? – user_mda Feb 08 '17 at 11:58

0 Answers0