开发者

Maven Systempath not working as expected

开发者 https://www.devze.com 2023-03-29 05:58 出处:网络
I have specified following dependencies(For examplementioned one here) in pom.xml which will look for saaj.jar under the specified sytempath and Maven used to pick it from same pathand working fine.

I have specified following dependencies(For example mentioned one here) in pom.xml which will look for saaj.jar under the specified sytempath and Maven used to pick it from same path and working fine.

<dependency>
<groupId>saaj</groupId>
<artifactId>saaj</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/saaj.jar</systemPath>
</dependency>

Now I have moved to windows 7 and Spring Tool suite 2.7.1 version(Previously Win XP and Spring older vesion). In this new setup am getting below error.

Missing artifact saaj:saaj:jar:1.0:system 

Now, It is looking for saaj-1.0.jar instead of saaj.jar and under the folder ${basedir}/src/main/webapp/WEB-INF/lib/saaj/saaj/1.0/ instead of ${basedir}/src/main/weba开发者_如何学Gopp/WEB-INF/lib/.

Why is it so? Please provide the solution where my previous setup should work fine.


Avoid systemPath, you must create a local repository like :

this is you pom file :

<repositories>
    <repository>
        <id>local-repo</id>
        <url>file://${basedir}/lib</url>
    </repository>
</repositories>


    <dependency>
      <groupId>tiago.medici</groupId>
      <artifactId>eureka</artifactId>
      <version>0.0.1</version>
    </dependency> 

on project you create a lib folder to put your jar and maven pom file generated from

mvn install:install-file -Dfile=c:\tiago.medici-0.0.1.jar -DgroupId=tiago.medici -DartifactId=eureka -Dversion=0.0.1 -Dpackaging=jar

tiago.medici-0.0.1.pom

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>tiago.medici</groupId>
  <artifactId>eureka</artifactId>
  <version>0.0.1</version>
  <description>POM was created from install:install-file</description>
</project>


Don't use system scope. It was meant for system provided libraries. Given the path you gave for it, you are obviously creating a web application.

Use a war project and specify your dependencies with provided scope if they're already available (e.g. because they are provided by your application server) or without a scope specification otherwise. Maven will take care of packaging your project dependency in a correct way, both for Eclipse development and for deployment in your application server.

0

精彩评论

暂无评论...
验证码 换一张
取 消