如何解决Assembly Plugin中无法识别的标记错误

时间:2014-02-13 11:00:34

标签: java maven-assembly-plugin

我正在研究Maven Assembly Project,我在Project中没有任何错误,我使用了Eclipse,但是当我使用Goal-clean软件包组件构建时:单个或mvn软件包然后我遇到了构建失败。

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.echo360.ess-plugins:ess-moodle-plugin:jar:2.5.15-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 64, column 19
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building EchoSystem Server Moodle Publishing Plugin 2.5.15-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ ess-moodle-plugin ---
[INFO] Deleting E:\moodle-example\target
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ ess-moodle-plugin ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 7 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ ess-moodle-plugin ---
[INFO] Compiling 2 source files to E:\moodle-example\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ ess-moodle-plugin ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\moodle-example\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ ess-moodle-plugin ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ ess-moodle-plugin ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ ess-moodle-plugin ---
[INFO] Building jar: E:\moodle-example\target\ess-moodle-plugin-2.5.15-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-assembly-plugin:2.2-beta-5:attached (default) @ ess-moodle-plugin ---
[INFO] Reading assembly descriptor: src/main/assembly/publisher.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.582s
[INFO] Finished at: Thu Feb 13 16:11:44 IST 2014
[INFO] Final Memory: 14M/112M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:attached (default) on project ess-moodle-plugin: Error reading assemblies: Error reading descriptor at: src/main/assembly/publisher.xml: Unrecognised tag: 'binaries' (position: START_TAG seen ...</dependencySets>\r\n    <binaries>... @25:15) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

这是我的POM.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  
  <modelVersion>4.0.0</modelVersion>  
  <groupId>com.echo360.ess-plugins</groupId>  
  <artifactId>ess-moodle-plugin</artifactId>  
  <packaging>jar</packaging>
  <name>EchoSystem Server Moodle Publishing Plugin</name>  
  <build> 
    <plugins> 
      <plugin> 
        <artifactId>maven-assembly-plugin</artifactId>  
        <inherited>false</inherited>  
        <executions> 
          <execution> 
            <phase>package</phase>  
            <goals> 
              <goal>attached</goal> 
            </goals>  
            <configuration>

              <archive>
                <manifest>
                  <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                </manifest>
                <manifestEntries>
                  <Implementation-Time>${buildNumber}</Implementation-Time> 
                </manifestEntries>
              </archive>
              <descriptors>
                <descriptor>src/main/assembly/publisher.xml</descriptor> 
              </descriptors> 
              <outputDirectory>${project.build.directory}</outputDirectory>
              <workDirectory>${project.build.directory}/assembly/work</workDirectory>
            </configuration>
          </execution> 
        </executions> 
      </plugin>  
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins> 
  </build>  
  <profiles> 
    <profile> 
      <id>non-anystream-env</id>  
      <activation> 
        <property> 
          <name>!running-on-anystream-net</name> 
        </property> 
      </activation>  
      <build> 
        <plugins> 
          <plugin> 
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-surefire-plugin</artifactId>  
            <configuration> 
              <skip>true</skip> 
            </configuration>  
            <executions> 
              <execution> 
                <id>surefire-ut</id>  
                <phase>unit-test</phase>  
                <goals> 
                  <goal>test</goal> 
                </goals>  
                <configuration> 
                  <skip>false</skip> 
                </configuration> 
              </execution> 
            </executions> 
          </plugin> 
        </plugins> 
      </build> 
    </profile> 
  </profiles>  
  <dependencies> 
    <!-- compile scope -->  
    <dependency>
      <groupId>com.echo360.ess</groupId>
      <artifactId>ess-plugin-sdk</artifactId>
      <version>2.5.15-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>com.echo360.ess</groupId>
      <artifactId>ess-plugin-lib</artifactId>
      <version>2.5.15-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>com.echo360.ess</groupId>
      <artifactId>ess-property</artifactId>
      <version>2.5.15-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>xmlrpc</groupId>
      <artifactId>xmlrpc</artifactId>
      <version>2.0</version>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.3</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.5.6</version>
    </dependency>
  </dependencies>  
  <version>2.5.15-SNAPSHOT</version>
</project>

这是我的publisher.xml

<assembly>
    <id>publisher</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
            <scope>compile</scope>
            <includes>
                <include>commons-codec:commons-codec</include>
                <include>xmlrpc:xmlrpc</include>
            </includes>
            <outputDirectory>lib</outputDirectory>
        </dependencySet>
    </dependencySets>
    <binaries>
        <includeDependencies>true</includeDependencies>
    </binaries>
    <fileSets>
        <!-- classes -->
        <fileSet>
            <directory>${project.build.directory}/classes</directory>
            <outputDirectory>/classes</outputDirectory>
            <excludes>
                <exclude>META-INF</exclude>
                <exclude>META-INF/*</exclude>
                <exclude>**/*_ar.properties</exclude>
                <exclude>**/*_de.properties</exclude>
                <exclude>**/*_es.properties</exclude>
                <exclude>**/*_ja.properties</exclude>
            </excludes>
        </fileSet>
        <!-- plugin.xml -->
       <fileSet>
            <directory>src/main/resources/META-INF</directory>
            <outputDirectory>/META-INF</outputDirectory>
            <includes>
                <include>plugin.xml</include>
            </includes>
        </fileSet>

    </fileSets>
</assembly>

这是我的结构: enter image description here

2 个答案:

答案 0 :(得分:2)

请尝试使用此方法:在之前添加“程序集:”。希望这会奏效。

 </project>
  The assembly:
  <assembly>
    <id>jar-with-dependencies</id>
    <formats>
      <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
      <dependencySet>
         <unpack>true</unpack>

         <unpackOptions>
            <excludes>
               <exclude>*.properties</exclude>
            </excludes>
          </unpackOptions>

      </dependencySet>
    </dependencySets>
    <fileSets>
      <fileSet>
        <directory>target/classes</directory>
      </fileSet>
    </fileSets>
  </assembly>

答案 1 :(得分:0)

我知道这个话题已经很老了,但我遇到了无法识别的 TAG useAllReactorProjects 的类似问题。

我所做的改变是在 pom.xml 中设置插件版本

  <artifactId>maven-assembly-plugin</artifactId>
  <version>3.3.0</version>
相关问题