2017-01-11 81 views
-1

我试图从我的项目中创建一个tar文件,其中包含项目JAR和它使用的库。无法识别的标记:'格式'

为此,我使用maven-assembly-plugin如下所述:

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

我有以下文件:

我已经复制粘贴以下到我project标签:

<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> 

但是,我收到此错误:

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

为什么会出现此错误?

这应该是一个有效的标签,对吧?

+0

这就是你包括在你的POM中的所有东西吗?那么应该封装这些配置的''标签呢?鉴于Maven错误,我怀疑它是否丢失,因为''标签似乎遵循''标签。 – Frelling

回答

1

<formats>标签进入组件描述符文件,而不是项目文件。如果你把在您发布的文档链接第二次看,它指定文件的开头开始:

<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"> 

从行家的错误是因为你把它变成pom.xml代替。

相关问题