2017-01-11 80 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代替。

相關問題