Convert EJB and WEB modules to Maven

1

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

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

1 answer

2

To add jars files, you add a dependency with scope = system, and add a sytempath element in 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, it is best if you are an open source library, see if it does not exist in the maven repository and configure it as a dependency with scope = compile. If this jar is your code, it is better to be one module and this module becomes a dependency on the other modules.

For good examples of design structure, search about archetypes, in your specific case the archetype "maven-archetype-j2ee-simple".

    
16.09.2016 / 07:03