是否可以通过maven命令将配置文件版本和部署到nexus

时间:2017-06-07 19:44:22

标签: maven maven-2 maven-plugin nexus maven-assembly-plugin

我正在研究一个java项目,我想在nexus上进行版本控制和存储配置文件。让我们假设java项目的文件结构如下。

src/  
conf/application.config  
pom.xml

运行mvn clean install时,是否可以将application.config文件部署到nexus。在每次构建之后,我希望将应用程序工件和配置工件部署到nexus。是否有任何maven插件用于此目的。

1 个答案:

答案 0 :(得分:0)

我管理maven-deploy-plugin部署文件。

http://maven.apache.org/plugins/maven-deploy-plugin/usage.html

您可以在下面找到一个示例。

 <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <executions>
                    <execution>
                        <id>deploy-file</id>
                        <!-- change to deploy-->
                        <phase>install</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <file>app.properties</file>
                    <repositoryId>stack.example.release</repositoryId>
                    <url>http://nexusserver/nexus/content/repositories/releases/</url>
                    <groupId>com.stack.example.config</groupId>
                    <artifactId>app</artifactId>
                    <packaging>properties</packaging>
                    <version>1.0.0</version>
                </configuration>
            </plugin>

        </plugins>
    </build>