我有一个需要org.apache.commons.lang3的EJB项目。我有我的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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.kable.newsstand.kdsejb</groupId>
<artifactId>kds-ejb</artifactId>
<version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>com.kable.maven</groupId>
<artifactId>kable-super-pom</artifactId>
<version>[0.1,1.0)</version>
</parent>
<dependencies>
....
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>ejbModule</sourceDirectory>
<resources>
<resource>
<directory>ejbModule</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
<archive>
<manifestEntries>
<Dependencies>org.apache.commons.lang3</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
当我投影&gt;出口&gt; EJB Jar文件,该依赖关系未列在MANIFEST.MF
中清单 - 版本:1.0
内置:BRay
Build-Jdk:9.0.1
创建者:Eclipse的Maven集成
我已经加入了maven-ejb-plugin 我还包括档案 - &gt; manifestEntries - &gt;插件的依赖关系节点
答案 0 :(得分:1)
好的,@ khmarbaise的回复,引导我看一些东西,结果如下。
更改pom.xml中的maven-ejb-plugin配置,如下所示。
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<jarName>kdsSession</jarName> <!-- I need a different jar name -->
<outputDirectory>${basedir}</outputDirectory> <!-- I want my jar in the root, not the /target -->
<ejbVersion>3.1</ejbVersion>
<archive>
<manifestEntries>
<Dependencies>org.apache.commons.lang3</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
然后我用ejb:ejb为目标创建了一个新的运行配置“Run as maven build ...”。
我使用新的Runtime配置来构建ejb.jar而不是Export - &gt; EJB Jar。