Packaging into a tar file in maven without creating a jar file

1.8k views Asked by At

I'm trying to package a text based file into .tar using maven. To achieve this I used an assembly plugin and it worked, but along with the file tar a jar is also being generated. How can I avoid that?

<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <id>all</id>
    <formats>
        <format>tar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>configuration</directory>
            <fileMode>0444</fileMode>
        </fileSet>
    </fileSets>
</assembly>
1

There are 1 answers

2
YMomb On BEST ANSWER

You can change the packaging of your project. I guess current packaging is jar, and thus the creation of a jar. You may use pom and configure the assembly plugin to attach its result (the tar) to your build.

You could also configure the jar plugin, to skip the creation of empty jar (if it is your case).

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.0.2</version>
    <configuration>
      <skipIfEmpty>true</skipIfEmpty>
    </configuration>
  </plugin>