Maven dependencies not resolved in Eclipse

2.3k Views Asked by At

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>[email protected]</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

2

There are 2 best solutions below

1
On

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>
3
On

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.