create an EAR with maven assembly plugin [closed]

2019-07-09 02:59发布

I try to create an EAR with the maven assembly plugin but I got an error message instead of EAR file...

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.3: single (assembly:package) on project business-serviceability-ear: Failed to create assembly: Error creating assembly archive bin: Failed to configure archiver: org.codehaus.plexus.archiver.dir.DirectoryArchiver: Cannot find setter, adder nor field in org.codehaus.plexus.archiver.dir.DirectoryArchiver for 'appxml' -> [Help 1]

The interesting part of my pom.xml:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<executions>
    <execution>
        <id>assembly:package</id>
        <phase>package</phase>
        <goals>
            <goal>single</goal>
        </goals>
        <configuration>
            <archiverConfig>
                <appxml>src/main/resources/META-INF/application.xml</appxml>
            </archiverConfig>
            <descriptors>
                <descriptor>src/main/assembly/bin.xml</descriptor>
            </descriptors>
        </configuration>
    </execution>
</executions>

Could you please help where I should put the element in the pom.xml? I have to put somehwere otherwise I get this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.3:single (assembly:package) on project business-serviceability-ear: Fail ed to create assembly: Error creating assembly archive bin: appxml attribute is required -> [Help 1]

Thank you, Viktor

1条回答
欢心
2楼-- · 2019-07-09 03:18

Sorry, I made a mistake in the bin.xml. I defined more format element not just one... this is the working solution.

    <formats>
<!--        <format>dir</format> -->
<!--        <format>war</format> -->
        <format>ear</format>
    </formats>
查看更多
登录 后发表回答