I'm having a hard time to make my Maven2 multi module project, with a deep project structure, appear as a single ear (with its dependencies - which includes 1 war, 2 ejbs and 1 jar) to be deployed in my JBOSS 5 server inside my Eclipse Ganymede (tab Servers).
我很难让我的Maven2多模块项目具有深入的项目结构,看起来像一个单一的耳朵(其依赖项 - 包括1个war,2个ejbs和1个jar)将部署在我的JBOSS 5服务器中在我的Eclipse Ganymede中(选项卡服务器)。
I've been trying to use Maven Eclipse Plugin to turn my projects into a WTP project without success. Therefore they appear to be deployed in the server they appear as separated projets.
我一直在尝试使用Maven Eclipse插件将我的项目变成WTP项目但没有成功。因此,它们似乎部署在服务器中,它们显示为独立的项目。
My project has 1 war, 2 ejbs and 1 jar that must be packaged inside an ear, each of the "subprojects" is a separate module.
我的项目有1个战争,2个ejbs和1个jar必须打包在耳内,每个“子项目”都是一个单独的模块。
Project's pom.xml (type pom):
Project的pom.xml(类型为pom):
...
<modules>
<module>ejb1</module>
<module>ejb2</module>
<module>war</module>
<module>jar</module>
<module>ear</module>
</modules>
...
The ear module is only responsable to pack the other modules together.
耳模块仅负责将其他模块封装在一起。
Is there a way to tell eclipse (ganymede) that all those projects (ejbs, war and jar) are inside the ear module so I can deploy the ear in the server?
有没有办法告诉eclipse(ganymede)所有这些项目(ejbs,war和jar)都在ear模块中,所以我可以在服务器中部署耳朵?
4 个解决方案
#1
What you want to do is have maven create the eclipse projects via mvn eclipse:eclipse This might be helpful.
你想要做的是让maven通过mvn eclipse创建eclipse项目:eclipse这可能会有所帮助。
#2
try m2eclipse (google it) and install the WTP integration tool, create a project using the maven wizard, change the type to pom in the pom xml editor, create a sub modules from the pom and that adds it as child, if its a web project it get the WTP behavior i.e it can be deployed to a j2ee container ( jboss / tomcat ), add a dep to the web module for ejb module in the web pom etc, deploy the web app to the container
尝试m2eclipse(google it)并安装WTP集成工具,使用maven向导创建项目,在pom xml编辑器中将类型更改为pom,从pom创建子模块并将其添加为子项,如果它是web项目它获得WTP行为,即它可以部署到j2ee容器(jboss / tomcat),在web模块中为web模块添加dep for web pom等,将web应用程序部署到容器
#3
Installing the m2eclipse with the optional WTP configuration worked for me. I also added the following to my parent pom to ensure the right natures and builders in the eclipse files
使用可选的WTP配置安装m2eclipse对我有用。我还将以下内容添加到我的父pom中,以确保eclipse文件中的正确性质和构建器
This yields eclipse .project files that are ready for m2eclipse. then I can Update the project files using m2eclipse allowing hot deploy the webapp and its dependencies
这会产生为m2eclipse准备好的eclipse .project文件。然后我可以使用m2eclipse更新项目文件,允许热部署webapp及其依赖项
<build>
...
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5.1</version>
<!--
Eclipse project natures: http: //vikashazrati.wordpress.com/2007/12/22/adding-project-nature-to-your-maven-pomxml/
Maven-eclipse-plugin: http: //maven.apache.org/plugins/maven-eclipse-plugin/
-->
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
<projectnature>org.eclipse.jem.workbench.JavaEMFNature</projectnature>
<projectnature>org.eclipse.wst.common.modulecore.ModuleCoreNature</projectnature>
<projectnature>org.eclipse.wst.common.project.facet.core.nature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>org.eclipse.wst.jsdt.core.jsNature</projectnature>
<projectnature>org.maven.ide.eclipse.maven2Nature</projectnature>
</additionalProjectnatures>
<buildcommands>
<buildcommand>org.eclipse.wst.jsdt.core.javascriptValidator</buildcommand>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>org.eclipse.wst.common.project.facet.core.builder</buildcommand>
<buildcommand>org.eclipse.wst.validation.validationbuilder</buildcommand>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
<buildcommand>org.maven.ide.eclipse.maven2Builder</buildcommand>
</buildcommands>
</configuration>
</plugin>
#4
use -Dwtpversion=2.0 parameter of maven or on command line mvn -Dwtpversion=2.0 in super pom project. i use m2eclipse plugin but has got some issues for multi module project. I use m2eclipse plugin for dependency management. If i want to clean, install etc. all project with super pom, i do it on command line. Also project properties must check in eclipse. Project Facets, Java EE Module dependencies must check. You can also export to ear project, but be carefull to check maven modules is compiled after changing.
在超级pom项目中使用-dwtpversion = maven的2.0参数或命令行mvn -Dwtpversion = 2.0。我使用m2eclipse插件,但多模块项目有一些问题。我使用m2eclipse插件进行依赖管理。如果我想用超级pom清理,安装等所有项目,我在命令行上执行。项目属性也必须在eclipse中检查。 Project Facets,Java EE Module依赖项必须检查。您也可以导出到ear项目,但要小心检查maven模块是否在更改后编译。
#1
What you want to do is have maven create the eclipse projects via mvn eclipse:eclipse This might be helpful.
你想要做的是让maven通过mvn eclipse创建eclipse项目:eclipse这可能会有所帮助。
#2
try m2eclipse (google it) and install the WTP integration tool, create a project using the maven wizard, change the type to pom in the pom xml editor, create a sub modules from the pom and that adds it as child, if its a web project it get the WTP behavior i.e it can be deployed to a j2ee container ( jboss / tomcat ), add a dep to the web module for ejb module in the web pom etc, deploy the web app to the container
尝试m2eclipse(google it)并安装WTP集成工具,使用maven向导创建项目,在pom xml编辑器中将类型更改为pom,从pom创建子模块并将其添加为子项,如果它是web项目它获得WTP行为,即它可以部署到j2ee容器(jboss / tomcat),在web模块中为web模块添加dep for web pom等,将web应用程序部署到容器
#3
Installing the m2eclipse with the optional WTP configuration worked for me. I also added the following to my parent pom to ensure the right natures and builders in the eclipse files
使用可选的WTP配置安装m2eclipse对我有用。我还将以下内容添加到我的父pom中,以确保eclipse文件中的正确性质和构建器
This yields eclipse .project files that are ready for m2eclipse. then I can Update the project files using m2eclipse allowing hot deploy the webapp and its dependencies
这会产生为m2eclipse准备好的eclipse .project文件。然后我可以使用m2eclipse更新项目文件,允许热部署webapp及其依赖项
<build>
...
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5.1</version>
<!--
Eclipse project natures: http: //vikashazrati.wordpress.com/2007/12/22/adding-project-nature-to-your-maven-pomxml/
Maven-eclipse-plugin: http: //maven.apache.org/plugins/maven-eclipse-plugin/
-->
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
<projectnature>org.eclipse.jem.workbench.JavaEMFNature</projectnature>
<projectnature>org.eclipse.wst.common.modulecore.ModuleCoreNature</projectnature>
<projectnature>org.eclipse.wst.common.project.facet.core.nature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>org.eclipse.wst.jsdt.core.jsNature</projectnature>
<projectnature>org.maven.ide.eclipse.maven2Nature</projectnature>
</additionalProjectnatures>
<buildcommands>
<buildcommand>org.eclipse.wst.jsdt.core.javascriptValidator</buildcommand>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>org.eclipse.wst.common.project.facet.core.builder</buildcommand>
<buildcommand>org.eclipse.wst.validation.validationbuilder</buildcommand>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
<buildcommand>org.maven.ide.eclipse.maven2Builder</buildcommand>
</buildcommands>
</configuration>
</plugin>
#4
use -Dwtpversion=2.0 parameter of maven or on command line mvn -Dwtpversion=2.0 in super pom project. i use m2eclipse plugin but has got some issues for multi module project. I use m2eclipse plugin for dependency management. If i want to clean, install etc. all project with super pom, i do it on command line. Also project properties must check in eclipse. Project Facets, Java EE Module dependencies must check. You can also export to ear project, but be carefull to check maven modules is compiled after changing.
在超级pom项目中使用-dwtpversion = maven的2.0参数或命令行mvn -Dwtpversion = 2.0。我使用m2eclipse插件,但多模块项目有一些问题。我使用m2eclipse插件进行依赖管理。如果我想用超级pom清理,安装等所有项目,我在命令行上执行。项目属性也必须在eclipse中检查。 Project Facets,Java EE Module依赖项必须检查。您也可以导出到ear项目,但要小心检查maven模块是否在更改后编译。