Maven dependencies not resolved in Eclipse

别说谁变了你拦得住时间么 提交于 2019-12-25 08:27:52

问题


I'm developing Oracle custom authentication plugin(OAM 11g) using maven dependencies.I've followed all the steps listed in Oracle documentation to add maven dependencies:

1)Created account with OTN and accepted the licence 2)Created my setting file and POM file and added the following:

<server>
    <id>maven.oracle.com</id>
      <username>myemail@gmail.com</username>
        <password>*******</password>
          <configuration>
           <basicAuthScope>
           <host>ANY</host>
           <port>ANY</port>
           <realm>OAM 11g</realm>
      </basicAuthScope>
      <httpConfiguration>
          <all>
          <params>
          <property>
          <name>http.protocol.allow-circular-redirects</name>
          <value>%b,true</value>
          </property>
          </params>
        </all>
      </httpConfiguration>
    </configuration>
  </server>

After following these steps, I still getthe error "The import oracle.security cannot be resolved" in my Java class, which means the dependencies and not resolved in my program. I would appreciate if anybody out there can help me understand this issue.Thanks


回答1:


You need add following repository definition to your pom.xml.

You get more Information here setting up multiple repositories

<repositories>
  <repository>
    <id>maven.oracle.com</id>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
    <url>https://maven.oracle.com</url>
    <layout>default</layout>
  </repository>
</repositories>
<pluginRepositories>
  <pluginRepository>
    <id>maven.oracle.com</id>
    <url>https://maven.oracle.com</url>
  </pluginRepository>
</pluginRepositories>



回答2:


I don't think this issue is related to oracle security. Jars related to oracle are not usually published to maven central due to licensing restriction. You will need to

  1. Upload jars manually to your company nexus or artifactory.
  2. OR keep them along with your project and use system dependency mechanism.

Point 2 explained:

  1. Maintain a jar folder in your project and keep jar files there.
  2. In your dependency snippet in pom ,
<dependencies>
    <dependency>
      <groupId>oracle.security</groupId>
      <artifactId>oracle-api</artifactId>
      <version>2.0</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/jars/oracle-api.jar</systemPath>
    </dependency>
 </dependencies>

Repeat above for other jars as well.

This will resolve your The import oracle.security cannot be resolved exception.



来源:https://stackoverflow.com/questions/42105442/maven-dependencies-not-resolved-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!