facebook

Build EAR for project

  1. MyEclipse IDE
  2.  > 
  3. Maven for MyEclipse (Maven4MyEclipse)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #519840 Reply

    eugenejsn
    Participant

    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?

    Thanks

    Eugene

    #519848 Reply

    support-swapna
    Moderator

    Eugene,

    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

    #520860 Reply

    eugenejsn
    Participant

    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 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/DependencyResolutionException

    Eugene

    #520950 Reply

    support-swapna
    Moderator

    Eugene,

    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
    |-> War

    I 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

    #521336 Reply

    eugenejsn
    Participant

    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?

    Thanks.

    Eugene

    #521425 Reply

    support-swapna
    Moderator

    Eugene,

    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

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Build EAR for project

You must be logged in to post in the forum log in