Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 519
Luigi De Masi Avatar asked Oct 17 '13 13:10

Luigi De Masi


People also ask

What is build artifacts in Maven?

In Maven terminology, an artifact is an output generated after a Maven project build. It can be, for example, a jar, war, or any other executable file. Also, Maven artifacts include five key elements, groupId, artifactId, version, packaging, and classifier.


1 Answers

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>
like image 200
Joe Avatar answered Oct 28 '22 23:10

Joe