0

I have a problem in front of me, witch I have no idea of how to start with, but let me first explain myself.

First, I found this post:

Maven2: Best practice for Enterprise Project (EAR file)

There is a similar problem to be solved, but If I am not mistaken, there is a word of 3 Maven projects that mentions Mike Cornell, who were answering the question. This part is not the same with me, and therefore, I cant use his answer. Or maybe I can?

I got two encapsulating EAR projects, each of them encapsulates a separate EJB and WAR project

Now, I worked with Ant so far, but I am forced to use Maven, and have no idea how to do it.

My workspace looks like this:

EAR-A
EJB-A
WAR-A
EAR-B
EJB-B
WAR-B

So, there is no Maven at all, and I looked on this post:

https://docs.jboss.org/tools/3.3.0.Final/en/maven_tools_reference_guide/html/adding_maven_support.html

To add maven support to an existing project, In witch case, I would be able to use the answer from Mike Cornell, that I mentioned above, BUT there is a problem.

My EJB-A and WAR-A depend on each other (I got a WsEndPoint there, for web-socket reasons, and therefore I have added each of them into the others build path), and when I follow the steps, of the converting to a Maven project, there is the step in the wizard that shows all dependencies of the project, there is a missing dependency, if I am in the EJB-A project, there is a missing dependency(error or could not find or something like that(cant remember...sorry)) of the WAR-A project, and the same when I do it with the WAR-A project, there is the same issue with the EJB project.

That was the reason I stopped, because, I was not sure how to deal with that.

My Maven looks like this:

enter image description here

As mentioned in the title, I need to do this from the command line. That is to build the EAR with the EJB and the WAR projects all together.

I work in the command line from the workspace, where all the projects are located, and hope that you can help me. Thanks.

Elydasian
  • 2,016
  • 5
  • 23
  • 41
  • I would recommend to take a look at this example which produces an ear using an War etc. https://github.com/khmarbaise/javaee ...as a start point. Furthermore I recommend to read the docs about Maven how the life cycle / dependencies / multi module build etc. looks like and work... – khmarbaise Dec 16 '17 at 10:22
  • thanks, I ll look into it. – Elydasian Dec 18 '17 at 08:58

1 Answers1

0

Ok, here is a solution I found and it worked for me.

First, I removed each project from the others build path, this way, they don't see each other.

Then in eclipse, I converted the projects to maven, and got the pom.xml file(s)

Then, I installed the projects with: mvn install This way, I got the projects into my local repository and could add them as dependencies to my other projects pom file

That worked for me, I hope this will be helpful to the other guy with a similar issue.

Elydasian
  • 2,016
  • 5
  • 23
  • 41