Maven GroupID and ArtifactID for J2EE Utility Project

619 views Asked by At

I have a collection of 3 existing Eclipse projects that I want to make into Maven projects and I'm having a hard time understanding the relationship between the GroupID, ArtifactID and my Java Packaging, and the different directory structure that is created for Maven vs. Java projects. I'm pretty new to J2EE and completely new to Maven, so any advice is welcome! Let me describe my projects first.

The first project is IDMU_JAR. The base Java packaging is com.foo.util.merge and it contains Java classes like Template and Bookmark and the target jar file is com.foo.util.merge.jar

The second project is IDUM_WAR. The base class in this project is com.foo.util.merge.web and it references the IDMU_JAR project and contains only a few Servlets that expose the functionality in IDMU_JAR.

The third project is IDMU_EAR. Currently this is just a device for creating a deployment EAR that contains IDMU_JAR, WAR and it's dependencies.

My questions are:

Is my J2EE packaging and naming "typical" or have I already gone against best practices?

Am I better off creating the Maven Project and then converting it to a Faceted project and picking the facets, or should I be creating the Java Utility/WAR/EAR projects and then converting them to Maven projects?

This appears to have a big impact on the directory structure of the project, is this important?.

Does my Eclipse Project name have to match the Maven Artifact ID?

1

There are 1 answers

7
bodyjares On BEST ANSWER

You can configure pretty much anything in maven from file structure to project special configuration. But If it's not absolutly necessery you should stick with maven defaults.

You can start with that project template: javaee-essentials-pom

For the project namings:

GroupID: com.foo

ArtifactID: idmu-utils, idmu-war, idmu-ear

package: jar, war, ear

With Eclipse:

Start by using the template I provided. Importing as maven project from Eclipse should resolve all facets available automatically.