简体   繁体   English

maven存储库设置无法正常工作

[英]maven repository setup not working

I am referencing a repository in my POM.xml to add the ojdbc.jar to my project but Maven (I use the STS plugin) keeps telling me it can't find the jar. 我在我的POM.xml中引用了一个存储库,将ojdbc.jar添加到我的项目中,但Maven(我使用STS插件)一直告诉我它找不到jar。
I am showing below my repositories and jar dependency as defined in my POM.xml. 我在我的POM.xml中定义的下面显示了我的存储库和jar依赖项。

Anyone has an idea as to why the jar can't be found? 任何人都知道为什么无法找到罐子? Is my POM.xml not setup properly? 我的POM.xml设置不正确吗?

Note the vaadin repo works fine as the vaadin jars are correctly added to my project. 请注意,vaadin repo工作正常,因为vaadin jar正确添加到我的项目中。

  <repositories>

    <repository>
    <id>myrepo</id>
    <url>http://mvnrepository.com/</url>
    </repository>

    <repository>
    <id>vaadin-addons</id>
    <url>http://maven.vaadin.com/vaadin-addons</url>
    </repository>
  </repositories>

and here is the dependency setup as defined at http://mvnrepository.com/artifact/ojdbc/ojdbc/14 : 这是http://mvnrepository.com/artifact/ojdbc/ojdbc/14中定义的依赖关系设置:

<dependencies>
<dependency>
  <groupId>ojdbc</groupId>
  <artifactId>ojdbc</artifactId>
  <version>14</version>
</dependency>
</dependencies>

To use Oracle jdbc(OJDBC) driver with Maven, you can download the jar to your local machine and install it manually into your Maven local repository. 要将Oracle jdbc(OJDBC)驱动程序与Maven一起使用,您可以将jar下载到本地计算机并手动将其安装到Maven本地存储库中。

After downloading the jar install using the following command :

mvn install:install-file -Dfile={Path_to_your_ojdbc.jar} -DgroupId=com.oracle 
-DartifactId=ojdbc -Dversion=14 -Dpackaging=jar . If the version is less than 14 change the appropriate version number  in -Dversion attribute

Now you can set the dependency details in the pom file :

<dependencies>
  <dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc</artifactId>
    <version>14</version>
  </dependency>
</dependencies>

Anyone has an idea as to why the jar can't be found? 任何人都知道为什么无法找到罐子?

The jar can't be found due to license constraints . 由于许可限制,无法找到 jar。

Is my POM.xml not setup properly? 我的POM.xml设置不正确吗?

No it isn't, but adding to your pom the dependency: 不,不是,但是向你的pom添加依赖:

<dependency>
    <groupId>ojdbc</groupId>
    <artifactId>ojdbc</artifactId>
    <version>14</version>
</dependency>

you are able to download only the ojdbc14 pom because it has not a license limitation about distribution. 您只能下载ojdbc14 pom,因为它没有关于分发的许可限制。

In order to make the above dependency works the jar has to be manually installed into your local Maven repository, without violating the license , by running: 为了使上述依赖性工作,必须通过运行以下方法将jar手动安装到本地Maven存储库中, 而不会违反许可证

mvn install:install-file -Dfile={Path_to_your_ojdbc.jar} -DgroupId=ojdbc 
-DartifactId=ojdbc -Dversion=14 -Dpackaging=jar

eventually changing to the appropriate version number in -Dversion attribute, as correctly suggested by user1570577 . 最终更改为-Dversion属性中的相应版本号,正如user1570577正确建议的那样

Oracle now has a maven repository: maven.oracle.com Oracle现在有一个maven存储库:maven.oracle.com

See https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle 请参阅https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle

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

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