问题
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
- Upload jars manually to your company nexus or artifactory.
- OR keep them along with your project and use system dependency mechanism.
Point 2 explained:
- Maintain a jar folder in your project and keep jar files there.
- 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