문제

When I package my pom.xml as an EJB I get an error that I do not understand. This error shows up if I touch the package in any way, to include Ctrl+S and Maven update. The error goes away if I change the packaging back to jar.

Code:

    <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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.myorg.buildparent</groupId>
    <artifactId>BuildParent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <groupId>com.myorg.myEjbPackage</groupId>
  <artifactId>MyEjbPackage</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>ejb</packaging>
</project>

By changing

<packaging>ejb</packaging>

to

<packaging>jar</packaging>

The error will go away.

Error string for reference:

'Building workspace' has encountered a problem.
Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'MyEjbPackage'.
org.codehaus.plexus.archiver.ArchiverException

Even though I can remove the error, I still feel like it should be packaged as an ejb. Does this make sense to anyone? Does my EJB package need to be packaged as a EJB in the pom? I should admit that my skills with Maven are around that of a novice/low intermediate.

도움이 되었습니까?

해결책

Try adding this configuration in your POM. The EJB plugin (which is bound to the lifecycle by default when you select ejb packaging type) doesn't use the same version of the archiver that the jar/war/ear plugins do.

There is a JIRA issue for updating the dependency versions, however it has not been worked yet.

<pluginManagement>
  <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ejb-plugin</artifactId>
        <version>${maven.ejb.plugin.version}</version>
        <dependencies>
          <!-- Use the same archiver as the other [j/w/e]-ar plugins -->
          <!-- See http://jira.codehaus.org/browse/MEJB-52 -->
          <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-archiver</artifactId>
            <version>2.5</version>
          </dependency>
          <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-archiver</artifactId>
            <version>2.3</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </pluginManagement>

Update

MEJB-52 is fixed in maven-ejb-plugin version 2.4 and later. Consider updating the plugin version to the latest before adding this configuration.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top