安装阶段的maven部署配置文件命令

时间:2017-02-07 22:04:11

标签: java maven continuous-deployment maven-antrun-plugin

我在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>

我想在这台服务器上从桌面部署jar,teh maven命令是什么来实现这个?

如果我运行以下

mvn deploy -Dmaven.project.branch=release

它将从settings.xml中获取部署设置并部署到存储库。

那么我可以在其他阶段运行ant任务吗?喜欢安装? 我只需要更改{cd_phase}来安装吗?并运行mvn install?

0 个答案:

没有答案