April 17, 2017 at 12:45 am #519840
ME 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?
EugeneApril 17, 2017 at 5:18 am #519848
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. 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.
MyEclipse SupportApril 26, 2017 at 10:24 am #520860
Once the EAR project is created, you can right click on the EAR project > Run As > Maven Build and select ‘package’ as build goal.
[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] 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] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
EugeneApril 27, 2017 at 9:23 am #520950
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 :
I am afraid our maven tooling has issues when it comes to JEE project creation.Please let us know how it works for you.
MyEclipse SupportMay 1, 2017 at 5:54 pm #521336
To 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?
EugeneMay 2, 2017 at 9:20 am #521425
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.