Search code examples
javamavenpom.xmlartifact

How "build" and deploy a plain text maven artifact


I have a maven module for holding a plain text file that I need to "build" (rename the file with name-version-classifier.extension format) and deploy on my maven repository. I know I can deploy it via command line but I want to know if i can write a pom.xml whereby I can achive the same result.

LDM.


Solution

  • From the discussion How to attach a text file to a module's distribution? :

    In the past i've made use of the Build Helper plug-in to attach additional artifacts https://www.mojohaus.org/build-helper-maven-plugin

    The example of how to attach additional artifacts to your project shows how to attach a file; make your module of type pom and the additional artifact will be the only artifact deployed:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>some file</file>
                  <type>extension of your file </type>
                  <classifier>optional</classifier>
                </artifact>
                ...
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>