简体   繁体   English

在 pom.xml 依赖标签中添加 jar 文件的 systemPath

[英]Adding systemPath for jar file inside pom.xml dependency tag

I have imported an existing maven project into eclipse IDE.我已将现有的 maven 项目导入 eclipse IDE。 The pom.xml have a dependency looking like below. pom.xml 具有如下所示的依赖关系。

    <dependency>
        <groupId>com.myApp</groupId>
        <artifactId>MyDBConn</artifactId>
        <version>0.0.0</version>
        <scope>system</scope>
        <systemPath>${basedir}/dependencies/MyDBConn.jar</systemPath>
    </dependency>

In the line在行

<systemPath>${basedir}/dependencies/MyDBConn.jar</systemPath>

I am getting an error saying我收到一条错误消息

Multiple annotations found at this line: - 'dependencies.dependency.systemPath' for com.myApp:MyDBConn:jar should not point at files within the project directory, ${basedir}/dependencies/MultiDBConn.jar will be unresolvable by dependent projects - 'dependencies.dependency.systemPath' for com.myApp:MyDBConn:jar must specify an absolute path but is ${basedir}/dependencies/MyDBConn.jar Multiple annotations found at this line: - 'dependencies.dependency.systemPath' for com.myApp:MyDBConn:jar should not point at files within the project directory, ${basedir}/dependencies/MultiDBConn.jar will be unresolvable by dependent projects - com.myApp:MyDBConn:jar 的“dependencies.dependency.systemPath”必须指定绝对路径,但为 ${basedir}/dependencies/MyDBConn.Z68995FCBF432492D15484DAC04A

I have MyDBConn.jar file in dependencies folder inside the project directory.我在项目目录内的依赖文件夹中有 MyDBConn.jar 文件。 In my understanding ${basedir} points to the path where pom.xml is located.据我了解 ${basedir} 指向 pom.xml 所在的路径。 Why am i getting this error then?那为什么我会收到这个错误?

That is not an error;这不是错误; it is a warning.这是一个警告。 Please check the logs again.请再次检查日志。 Maven is warning you that the dependency MyDBConn.jar will not be available to other projects that depend on this project (the one that depends on MyDBConn.jar ). Maven 警告您依赖MyDBConn.jar将不可用于依赖此项目的其他项目(依赖于MyDBConn.jar的项目)。

Is com.myApp.MyDBConn something you wrote? com.myApp.MyDBConn是你写的吗? You can run mvn clean install on that project to place the jar in your local Maven repository.您可以在该项目上运行mvn clean install以将 jar 放置在本地 Maven 存储库中。 Then, you can use it like:然后,您可以像这样使用它:

<dependency>
    <groupId>com.myApp</groupId>
    <artifactId>MyDBConn</artifactId>
    <version>0.0.0</version>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM