我正在尝试使用Maven2 eclipse-plugin为RAD7.5生成eclipse项目文件。除了EAR的.project文件中的依赖项外,一切顺利。
当我在一个干净的maven项目上运行mvn eclipse:eclipse时,我想出了一个像这样的EAR:
<projectDescription>
<name>MyEAR</name>
<comment>The .project file of MyEAR</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
<buildCommand>
<name>com.ibm.etools.validation.validationbuilder</name>
</buildCommand>
<buildCommand>
<name>com.ibm.sse.model.structuredbuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
</natures>
</projectDescription>
但是我想要出现这样的事情:
<projectDescription>
<name>MyEAR</name>
<comment>The .project file of MyEAR</comment>
<projects>
<project>MyProjectConnector</project>
<project>MYProjectEJB</project>
<project>MyProjectDependents</project>
<project>MyProjectLOG</project>
</projects>
...
</projectDescription>
RAD7.5不了解项目结构,除非依赖项目列在&lt;项目&gt;。 但是我如何使用eclipse-plugin做到这一点?我在pom中列出了依赖项目,因此它们在.project文件中显示为&lt;项目&gt;?
编辑&gt;&GT; 这是我的pom文件的maven-eclipse-plugin配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.6</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>1.5</wtpversion>
<packaging>ear</packaging>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
</build>
&LT;
EDIT2:我必须补充说项目构建正常,即mvn clean install工作正常,所以基本上问题在于eclipse插件配置。
EDIT3:maven项目以下列方式构建:
MyEAR-reactor-build
|-- pom.xml
|-- MyEAR
| |-- pom.xml
|-- MYProjectEJB
| |-- pom.xml
`-- . . .
所有人都非常感激!!! (感谢您阅读此内容:)
答案 0 :(得分:1)
您是否已将模块和依赖项目声明为EAR POM中的依赖项?
<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>
<packaging>ear</packaging>
<groupId>so.com</groupId>
<artifactId>MyEAR</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>so.com</groupId>
<artifactId>MYProjectEJB</artifactId>
<scope>runtime</scope>
<type>ejb</type>
</dependency>
. . .
</dependencies>
. . .
答案 1 :(得分:1)
您可能需要创建模块反应器构建 -
MyEAR-reactor-build
|-- pom.xml
|-- MyEAR
| |-- pom.xml
|-- MYProjectEJB
| |-- pom.xml
`-- . . .
反应堆构建POM看起来像这样 -
<?xml version="1.0" encoding="UTF-8"?>
<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>so.com</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>MyEAR-reactor-build</artifactId>
<packaging>pom</packaging>
. . .
<modules>
<module>MyEAR</module>
<module>MYProjectEJB</module>
. . .
</modules>
</project>
答案 2 :(得分:0)
<useProjectReferences>false</useProjectReferences>
由于某种原因,在我的pom中将此设置为true并未覆盖父设置。也许是eclipse插件中的一个错误?无论如何,在父pom设置为true之后,一切顺利。谢谢大家的帮助!