Domanda

I'm new to Maven and I created a new web app to "migrate" an old application and to start using Maven 3. This application uses some libraries (jars) and most of them are under the shared/lib folder in Tomcat (5.5) directory.

How can add these libs to Maven POM? Should I add them at all?

I forgot to mention that some of these jars cannot be found in Maven repository since are more like utility libraries that are common to most of the projects.

È stato utile?

Soluzione

In the <dependencies/> section of the POM, you can declare the shared jar as a "system" scoped dependency. This scope recognizes a <systemPath/> child element, allowing you to point to the filesystem location on the local (build) filesystem.

See Maven "System" dependencies

example:

<project>
…
  <dependencies>
    <dependency>
      <groupId>com.example</groupId>
      <artifactId>someDependency</artifactId>
      <version>1.0.1</version>
      <scope>system</scope>
      <systemPath>${tomcatHome}/shared/lib/someDependency-1.0.1.jar</systemPath>
    </dependency>
  </dependencies>
…
</project>

Altri suggerimenti

Use

 <dependency>

tags to specify the libraries. And if some of the libraries are not found in the maven repository. Specify the repository using

<configuration>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top