Вопрос

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.

Это было полезно?

Решение

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>

Другие советы

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>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top