简体   繁体   English

如何在NetBeans的另一个Maven项目中添加我的一个项目jar

[英]how to add my one project jar in another maven project in netbeans

I have one project jar oauth. 我有一个项目jar oauth。 I want to add it in another maven project . 我想将其添加到另一个Maven项目中。 I tried to change pom.xml file but no effect. 我试图更改pom.xml文件,但没有效果。 Can anyone please suggest me? 有人可以建议我吗?

I tried to add following dependency in my pom.xml file: 我试图在我的pom.xml文件中添加以下依赖项:

<dependency>
  <groupId>com.payupaisa.oauth</groupId>
  <artifactId>auth</artifactId>
  <version>1.0.0</version>
  <type>jar</type>
  <scope>system</scope>
  <systemPath>${basedir}/src/main/webapps/WEB-INF/lib/auth.jar</systemPath>
</dependency>

With the assumption that you have that auth.jar in your local repository (as it builds fine). 假设您在本地存储库中拥有该auth.jar(因为它可以正常构建)。

Why don't you give a try like this. 你为什么不尝试这样。

<dependency>
  <groupId>com.payupaisa.oauth</groupId>
  <artifactId>auth</artifactId>
  <version>1.0.0</version>
  <scope>compile</scope>
</dependency>

Honestly speaking I don't prefer to give the jar location in my pom file and using scope as system, I leave this task to handle by Maven to resolve all the artifacts either by searching in local maven repository first(/.m2) or in MAVEN CENTRAL REPO if it is a 3rd party jar. 坦白地说,我不喜欢在jar文件中指定jar位置并使用scope作为系统,我让该任务由Maven处理,以解决所有工件的问题,方法是先在本地Maven存储库中搜索(/.m2)或在MAVEN CENTRAL REPO,如果它是第3个派对罐。

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

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