Convert EJB and WEB modules to Maven

Asked

Viewed 206 times

1

My project consists of three modules: EAR, EJB and WEB. I know Maven goes way beyond dependency control, but to start I just want to use it to control dependencies. I tried to convert the modules EJB and WEB, some jars were not found, I have the following doubts:

  • Missing jars should be included in the build path or directly referenced in pom.xml?
  • The best way to convert modules would be to use Configure -> Convert to Maven Project option?
  • It would be a good practice to create a new module (project) Maven only with the dependencies, it would not be necessary to convert the existing modules, it would only refer to the module Maven.
  • What would be the best structure for using Maven?

1 answer

2

To add jars, you add a dependency with the Scope=system, and add a sytempath element to the dependency with the jar path, for example:

<dependency>
    <groupId>groupId</groupId>
    <artifactId>biblioteca</artifactId>
    <scope>system</scope>
    <systempath>/caminho_do_jar/biblioteca.jar</systempath>
</dependency>

But this is not recommended, the best is that if it is an open source library, see if it does not exist in Maven Repository and set up as a dependency with Scope=Compile. If this jar is your code, it better be a module and this module becomes dependent on the other modules.

For good examples of design structure, research on archetypes, in your specific case the archetype "Maven-archetype-j2ee-simple".

  • Thanks Julio, I will search on Maven-archetype-j2ee-simple.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.