- This topic has 5 replies, 2 voices, and was last updated 7 years, 7 months ago by support-swapna.
-
AuthorPosts
-
eugenejsnParticipantME 2017 on Windows 7.
This was how I created an EAR before: I went to File –> New –> Web Project, then right mouse clicked on the project –> Export –> Java EE –> EAR. The created EAR file contained WAR and JAR files inside. I then deployed the EAR file to an application server such as the JBoss AS. That worked fine.
Now, I did something differently. This time, I created a MAVEN project (File –> New –> Maven Project). Inside this project, there are web related files and java files. I intended to create a EAR file which will contains the WAR and JAR files inside. I then will deploy the EAR file to the JBoss AS.
How can I create the EAR on this Maven project?
Thanks
Eugene
support-swapnaModeratorEugene,
You can create an EAR project using File > New > Enterprise Application Project. Change the JavaEE version to JavaEE 6 for deployment to JBoss 7.x, enable the ‘Add maven support’ and in the next page, select the already created maven project as module to add to the EAR project. Once the EAR project is created, you can right click on the EAR project > Run As > Maven Build and select ‘package’ as build goal. The successful build will create the .ear file.
Hope this helps.
–Swapna
MyEclipse Support
eugenejsnParticipantOnce the EAR project is created, you can right click on the EAR project > Run As > Maven Build and select ‘package’ as build goal.
Error found:
[ERROR] Failed to execute goal on project TestWebEAR: Could not resolve dependencies for project TestWebEAR:TestWebEAR:ear:0.0.1-SNAPSHOT: Could not find artifact com.myweb:TestWebApp:war:0.0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionExceptionEugene
support-swapnaModeratorEugene,
Sorry that you are seeing this issue.
You can install the maven project to the local repository and then generate the ear. Right click on the maven project and select Run As > Maven Install to install the file into the local repository.
Alternatively you can also create a parent pom, referred as parent in the war and ear poms and then run the package goal.
The structure should be as below :
myProject
|-> EAR
|-> WarI am afraid our maven tooling has issues when it comes to JEE project creation.Please let us know how it works for you.
–Swapna
MyEclipse Support
eugenejsnParticipantTo create the EAR file for the MAVEN project (TestMavenWeb) which I created by File –> New –> Project –> Maven Project –> achetype webapp, can I simply do the following:
Right mouse click on TestMavenWeb –> Export –> Java EE –> Ear to generate the final EAR file?
Thanks.
Eugene
support-swapnaModeratorEugene,
I am afraid it is not the right way to create a maven EAR project. You have to run the maven package command to create an EAR project.
–Swapna
MyEclipse Support -
AuthorPosts