我如何知道从Maven构建中生成的EAR的Java版本?我使用Maven构建了一个EAR,并将J2ee依赖项添加为
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>j2ee</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>在pom.xml里。如何确保生成的EAR是Java版本6的EAR?
发布于 2015-04-23 22:14:29
你是混合在这里的东西-依赖和包装。
首先,如果您计划使用WebSphere,最好将WebSphere依赖项安装到本地存储库中,而不是添加不同的依赖项(您不需要安装WebSphere解放的依赖项,因为它们可以远程使用)。您可以在这里找到特定WAS版本的安装poms:http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/com/ibm/tools/target/
然后在web或ejb项目中添加如下依赖项:
<dependency>
<groupId>com.ibm.tools.target</groupId>
<artifactId>was</artifactId>
<version>8.5.5</version>
<type>pom</type>
<scope>provided</scope>
</dependency>或者使用IBM WebSphere存储库中可用的预配置原型之一为WebSphere创建web/ejb应用程序。
对于打包,您可以使用maven-ear-plugin,如下所示。对于Java,ear键设置是configuration中的那个configuration元素。您需要提供这个默认值为1.3。
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
<configuration>
<generateApplicationXml>false</generateApplicationXml>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<modules>
<webModule>
<groupId>helloApp</groupId>
<artifactId>helloWeb</artifactId>
<contextRoot>/helloWeb</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>https://stackoverflow.com/questions/29822371
复制相似问题