1

I am working on a java project and I would like to version and store a configuration file on nexus. Lets assume the file structure of java project is as below.

src/  
conf/application.config  
pom.xml

Is it possible to deploy application.config file to nexus when I run mvn clean install. After each build I expect an application artifact and a configuration artifact to be deployed to nexus. Is there any maven plugin for this purpose.

Gray
  • 115,027
  • 24
  • 293
  • 354
clockworks
  • 3,755
  • 5
  • 37
  • 46
  • You can add the files via build-helper-maven-plugin or you can package the configuration into a jar/zip file or if you have more configuration for each environment you can take a look at: https://github.com/khmarbaise/multienv-maven-plugin – khmarbaise Jun 08 '17 at 06:29

1 Answers1

0

I manged to deploy file with maven-deploy-plugin.

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

You can find an example below.

 <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>
clockworks
  • 3,755
  • 5
  • 37
  • 46