Unrecognised tag: 'formats'

Asked at 2017-01-11 18:12:26Z
  • 5 Subscribers
  • 114 Views
-1

I'm trying to create a tar file from my project, containing the project JAR and the libraries which it uses.

To that end, I'm using maven-assembly-plugin as described here:

https://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html

I have the following file:

I have copy pasted the following into my project tag:

<formats>
        <format>tar.gz</format>
    </formats>

    <fileSets>
        <fileSet>
            <includes>
                <include>README*</include>
            </includes>
        </fileSet>
        <fileSet>
            <directory>src/bin</directory>
            <outputDirectory>bin</outputDirectory>
            <includes>
                <include>*.bat</include>
            </includes>
            <lineEnding>dos</lineEnding>
        </fileSet>
        <fileSet>
            <directory>src/bin</directory>
            <outputDirectory>bin</outputDirectory>
            <includes>
                <include>hello</include>
            </includes>
            <lineEnding>unix</lineEnding>
            <fileMode>0755</fileMode>
        </fileSet>
        <fileSet>
            <directory>target</directory>
            <outputDirectory>lib</outputDirectory>
            <includes>
                <include>generate-assembly-*.jar</include>
            </includes>
        </fileSet>
    </fileSets>

However, I'm getting this error:

 Unrecognised tag: 'formats' (position: START_TAG seen ...</dependencies>\n\n\n    <formats>... @239:14)

Why would this error appear?

This should be a valid tag, right?


1 answers in total

1
NimrodArgov Posted at 2017-01-12 07:26:20Z

The <formats> tag goes into the assembly descriptor file, not the project file. If you take a second look at the documentation link you posted, it specifies the beginning of the file starts with:

<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">

The error from maven is because you put it into pom.xml instead.

Answer this questsion