2011-03-03 679 views
26

構建我的項目時得到了Error reading assemblies: No assembly descriptors found。我試圖爲我的.sh文件設置權限,並排除令我討厭的應用程序崩潰的令​​人討厭的.jar文件...我認爲問題不在於此,儘管......讀取程序集時出錯:找不到程序集描述符

我的maven-assembly插件是加入這樣在我的pom.xml文件:

<plugin> 
     <artifactId>maven-assembly-plugin</artifactId> 
     <version>2.2.1</version> 
     <executions> 
     <execution> 
      <id>make-assembly</id> 
      <phase>package</phase> 
      <goals> 
      <goal>single</goal> 
      </goals> 
      <configuration> 
      <descriptors> 
      <descriptor>src/main/assembly/src.xml</descriptor> 
      </descriptors> 
      </configuration> 
     </execution> 
     </executions> 
</plugin> 

我的裝配描述是這樣的:

<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>my-assembly-descriptor</id> 
    <formats> 
    <format>jar</format> 
    <format>war</format> 
    </formats> 
    <fileSets> 
     <fileSet> 
      <directory>${project.build.directory}</directory> 
      <outputDirectory>${project.build.directory}</outputDirectory> 
      <includes> 
       <include>*.sh</include> 
      </includes> 
      <fileMode>0755</fileMode> 
     </fileSet> 
    </fileSets> 
    <dependencySets> 
    <dependencySet> 
     <excludes> 
     <exclude>spring-2.5.4.jar</exclude> 
     </excludes> 
    </dependencySet> 
    </dependencySets> 
</assembly> 

在我的項目結構爲:

Interface - src - main - assembly - src.xml 

      - pom.xml 

當試圖做的運行方式 - >調試爲 - >然後在目標將 assembly:single

我得到同樣的錯誤。我試着在控制檯上,assembly:assembly,我什麼都沒有。我甚至試圖把一個錯誤的路徑給我的程序集描述符,但錯誤沒有改變。當在我的程序集描述符的路徑前放${basedir}/時,我會得到相同的結果。

我有Ubuntu的10.10小牛狐獴,我與Eclipse EE工作,...

謝謝!

回答

4

看來您已經在<build>...<pluginManagement>...<plugins>中配置了程序集插件。如果你在<build>...<plugins>配置插件,它應該可以工作。

<build> 
    <plugins> 
    <plugin> 
     <artifactId>maven-assembly-plugin</artifactId> 
     <version>2.2.1</version> 
     <executions> 
     <execution> 
      <id>make-assembly</id> 
      <phase>package</phase> 
      <goals> 
      <goal>single</goal> 
      </goals> 
      <configuration> 
      <descriptors> 
       <descriptor>src/main/assembly/src.xml</descriptor> 
      </descriptors> 
      </configuration> 
     </execution> 
     </executions> 
    </plugin> 
    </plugins> 
</build> 
18

我一直使用的版本的maven-assembly-plugin2.3,但我相信這個問題是一樣的:如果組裝結構的執行內聲明的,它從mvn package工作,但不會從mvn assembly:assembly工作。

我已發現該溶液是聲明在插件的頂級配置的結構中,並保持執行儘可能小:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <version>2.3</version> 
    <configuration> 
     <descriptors> 
      <descriptor>src/main/assembly/standalone.xml</descriptor> 
     </descriptors> 
     <finalName>standalone</finalName> 
    </configuration> 
    <executions> 
     <execution> 
      <id>standalone</id> 
      <phase>package</phase> 
      <goals> 
       <goal>single</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 
相關問題