Error trying to import oracle jdbc7 driver with Maven - java

I cannot import the jdbc7 oracle driver with maven, I did everything like in the tutorial Oracle Blogs but I received the follow error:
Could not resolve dependencies for project
com.jp:database_connection_app:jar:0.0.1: Failed to collect
dependencies at com.oracle.jdbc:ojdbc7:jar:12.1.0.2: Failed to read
artifact descriptor for com.oracle.jdbc:ojdbc7:jar:12.1.0.2: Could
not transfer artifact com.oracle.jdbc:ojdbc7: pom:12.1.0.2 from/to
maven.oracle.com (https://maven.oracle.com): unexpected end of stream
on Connection{maven.oracle.com:443, proxy=HTTP # /myProxyIP:myPort
hostAddress=hostAddressIP cipherSuite=none protocol=http/1.1}
(recycle count=0): \n not found: size=0 content=... ->
A special case to me is that I'm in behind a proxy but I already configure the settings.xml file and maven can download all the dependencies except the JDBC.
In the tutorial mentioned, I didn't understand which information shall be hier...
<basicAuthScope>
<host>ANY </host>
<port>ANY </port>
<realm>OAM 11g </realm>
</basicAuthScope>
Maybe this is the error source.
Here is my settings.xml...
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<usePluginRegistry>false</usePluginRegistry>
<offline>false</offline>
<pluginGroups/>
<servers>
<server>
<id>maven.oracle.com</id>
<username>myUsername</username>
<password>My_Encripted_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>
</servers>
<mirrors>
<mirror>
<id>UK</id>
<name>UK Central</name>
<url>http://uk.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<proxies>
<proxy>
<id>default</id>
<active>true</active>
<protocol>http</protocol>
<host>myProxy</host>
<port>myPort</port>
<username>myUsername</username>
<password>myPassword</password>
<nonProxyHosts>*.google.com</nonProxyHosts>
</proxy>
</proxies>
<profiles/>
<activeProfiles/>
</settings>
Here is my POM...
<dependencies>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ucp</artifactId>
<version>12.1.0.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven.oracle.com</id>
<name>oracle-maven-repo</name>
<url>https://maven.oracle.com</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven.oracle.com</id>
<name>oracle-maven-repo</name>
<url>https://maven.oracle.com</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
The settings-security.xml is created under the same path of the settings.xml
Thanks for the help.

I couldn't import the library like I wanted, then I had to search for another solution:
Download the Jar from Oracle Web Site
Include Jar to maven local repository. Learned from Mkyong Web Site
Update Pom with the dependency
If someone have another idea, I will be happy to know that.

Related

Use Nexus repository for Maven

I´m trying to configure my maven to use a Nexus repository. What I´m trying to achieve should be very common: I want to have a Nexus repository working as a proxy for central dependencies and also two repositories for snapshots and releases. There´s plenty of documentation out there, but I am not able to get it running.
I edited my settings.xml so that it looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0
http://maven.apache.org/xsd/settings-1.1.0.xsd">
<localRepository>${M2_REPO}</localRepository>
<servers>
<server>
<id>nexus</id>
<username>myuser</username>
<password>mypass</password>
<url>https://snapshoturl</url>
</server>
<server>
<id>nexus-releases</id>
<username>myuser</username>
<password>mypass</password>
<url>https://releaseurl</url>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<url>https://groupurl</url>
<username>myuser</username>
<password>mypass</password>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>nexus</id>
<url>https://snapshoturl</url>
<username>myuser</username>
<password>mypass</password>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!--<repository>
<id>nexus-releases</id>
<url>https://releaseurl</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>-->
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://groupurl</url>
<username>myuser</username>
<password>mypass</password>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>myprofile</activeProfile>
</activeProfiles>
</settings>
But I always get the following error message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-
plugin:2.7:deploy (default-deploy) on project share.logging: Failed to
retrieve remote metadata xxx:share.logging:1.0.0-SNAPSHOT/maven-
metadata.xml: Could not transfer metadata
xxx:share.logging:1.0.0-
SNAPSHOT/maven-metadata.xml from/to p19dai-internal (https://snapshoturl):
Not authorized , ReasonPhrase:Authorization Required. -> [Help 1]
Can anyone help me here? What am I missing?
The problem is in your pom file. The ID in the "distributionManagement" section needs to match an ID in the settings.xml file's "servers". That's how the deployment credentials are looked up by Maven.
Are you running the mvn build via eclipse or eclipse based IDE?
then go to Go to Window --> Preferences
look for maven in the list and then user settings give the path to your settings.xml in both the global settings and the user settings and click apply
also set your .m2 repo path

JCenter - Return code is: 401, ReasonPhrase: Unauthorized

When deploying with $mvn deploy for a linked artifact into JCenter, I get this error Return code is: 401, ReasonPhrase: Unauthorized.
What is causing this, and how to fix this?
Solution is to have this in the artifact's pom.xml
<distributionManagement>
<snapshotRepository>
<id>bintray-yourusername-maven-yourpackagename</id> <!-- same id with the server in settings.xml -->
<name>oss-jfrog-artifactory-snapshots</name>
<url>http://oss.jfrog.org/artifactory/oss-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
And have this in the settings.xml
<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<servers>
<server>
<id>bintray-yourusername-maven-yourpackagename</id> <!-- same id with the snapshotRepository -->
<username>yourusername</username>
<password>your_api_key</password>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray-plugins</name>
<url>http://jcenter.bintray.com</url>
</pluginRepository>
</pluginRepositories>
<id>bintray</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>bintray</activeProfile>
</activeProfiles>
</settings>
Without seeing your pom file, my bet is you're trying to upload a SNAPSHOT to Bintray. Bintray is a distribution platform and intended for releases only.
You're more than welcome to use oss.jfrog.org for snapshots of packages, which are included in JCenter.

Uploading Jersey jars to local artifactory

I've been trying for almost a day now to deploy jar files from Jersey to our local Artifactory using Maven. I have made a few small changes to branch 2.6.x of Jersey and have built and packaged the jars. Here is the excerpt of parent pom from Jersey:
<groupId>org.glassfish.jersey</groupId>
<artifactId>project</artifactId>
<packaging>pom</packaging>
<version>2.6.rn-SNAPSHOT</version>
<name>jersey</name>
<description>
Jersey is the open source (under dual CDDL+GPL license) JAX-RS 2.0 (JSR 339)
production quality Reference Implementation for building RESTful Web services.
</description>
<distributionManagement>
<repository>
<id>central</id>
<name>central-repo</name>
<url>http://localhost/artifactory/libs-releases-local</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>central-repo-snapshots</name>
<url>http://localhost/artifactory/libs-snapshots-local</url>
</snapshotRepository>
</distributionManagement>
I have my settings.xml generated by artifactory and placed in ~/.m2/settings.xml
But when I try to deploy using mvn deploy, I get the following:
Uploading: (https: //maven.java.net/content/repositories/snapshots/):
Failed to transfer file: https://maven.java.net/content/repositories/snapshots/org/glassfish/jersey/project/2.6.rn-SNAPSHOT/project-2.6.rn-20150218.212627-1.pom.
Return code is: 401, ReasonPhrase: Unauthorized.
My complete settings.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<username>admin</username>
<password>admin</password>
<id>central</id>
</server>
<server>
<username>admin</username>
<password>admin</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-releases</name>
<url>http://localhost/artifactory/libs-releases</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshots</name>
<url>http://localhost/artifactory/libs-snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-releases</name>
<url>http://localhost/artifactory/plugins-releases</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshots</name>
<url>http://localhost/artifactory/plugins-snapshots</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
You must add the distributionManagement tag in your pom.xml, where the url will be your Artifactory's url and add the credentials in settings.xml
You can read more about this here.

Maven Settings for multiple repositories

I have the following in settings.xml
<mirrors>
<mirror>
<id>paid-jars</id>
<name>jars with license</name>
<url>http://url:8081/nexus/content/repositories/paidjars/</url>
<mirrorOf>!central</mirrorOf>
</mirror>
<mirror>
<id>Org-central</id>
<name>mirror of central</name>
<url>http://url:8081/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
In pom.xml I have two jars
apache-commons.jar (which I assumes to be downloaded from central)
licensed.jar (which I assume to be downloaded from paid-jars)
But when I run maven clean install it tries to download licensed.jar from Org-central.
How can I make it use paid-jars to download? Is it possible first it goes to Org-central and if fails it tries at paid-jars? If so, how? I don't want to put repo entries in pom.xml
Settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
<proxy>
<id>Proxy</id>
<active>true</active>
<protocol>http</protocol>
<username>username</username>
<password>******</password>
<host>host.url</host>
<port>8080</port>
<nonProxyHosts>local.net|internal.com</nonProxyHosts>
</proxy>
</proxies>
<mirrors>
<mirror>
<id>paid-jars</id>
<name>jars with license</name>
<url>http://url:8081/nexus/content/repositories/paidjars/</url>
<mirrorOf>!central</mirrorOf>
</mirror>
<mirror>
<id>Org-central</id>
<name>mirror of central</name>
<url>http://url:8081/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>compiler</id>
<properties>
<JAVA_1_7_HOME>C:\Program Files (x86)\Java\jdk1.7.0_51\bin</JAVA_1_7_HOME>
</properties>
</profile>
</profiles>
</settings>
you have to setup mirror
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://internal/nexus/content/repositories/thirdparty</url>
</mirror>
<mirror>
<id>google</id>
<mirrorOf>google</mirrorOf>
<url>http://google-maven-repository.googlecode.com/svn/repository</url>
</mirror>
then add internal & external repo
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<name>central</name>
<url>http://internal/nexus/content/repositories/thirdparty</url>
</repository>
<repository>
<id>google</id>
<name>google</name>
<url>http://google-maven-repository.googlecode.com/svn/repository</url>
</repository>
</repositories>
</profile>
If you need to distinguish between an internal (Nexus, Artifactory, ..) repository and Maven central, the already discussed solutions here based on multiple Mirrors using the <mirrorOf> tags capabilities (as described in the official docs also ) work fine (the same with this so Q&A ).
BUT in our case, where we wanted some libraries to be downloaded from internal Nexus 1 - and others (with the same package names, but different versions) from internal Nexus 2, those solutions didn't work. We simply couldn't use the <mirrorOf> tag.
We found another solution based on multiple <repository> definitions INSIDE of an ever activated Maven profile (it didn't work without the profile definition!!). Here's our settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- The resolution of multiple Repositories only works with profiles!-->
<profiles>
<profile>
<id>use-multiple-repos</id>
<!--Request multiple Repositories for dependencies -->
<repositories>
<repository>
<id>nexus-repository</id>
<name>Internal Nexus Repository 1 https://nexus.your.lan</name>
<url>https://nexus.your.lan/repository/maven-public/</url>
</repository>
<repository>
<id>nexus-repository-2</id>
<name>Internal Nexus Repository 2 https://nexus2.completely.other.net</name>
<url>https://nexus2.completely.other.net/repository/maven-public/</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>use-multiple-repos</activeProfile>
</activeProfiles>
</settings>
If you're looking for a full-blown settings.xml, where - besides the multiple repositories - also a corporate proxy is defined alongside with the credentials for maven-releases and maven-snapshots users to push to the corporate Nexus 1, have a look at this gist.
And if you want to check fast, if you're configuration is working, you could simply use maven-dependency-plugin's dependency:get:
mvn dependency:get \
-DgroupId=your.package.name \
-DartifactId=yourArtifactId \
-Dversion=YOURVERSION \
-Dpackaging=jar
If this results in a BUILD SUCCESS, where a minimum of one dependency from Nexus 1 and one of Nexus 2 could be downloaded, everything should work as expected and looks somehow like this (omitted lot's of packages!):
[INFO] Resolving your.first.package:artifact1.jar:1.1.0
Downloaded from nexus-repository: https://nexus.your.lan/repository/maven-public/your/first/package/artifact/1.1.0/artifact2.jar (575 kB at 868 kB/s)
[INFO] Resolving your.second.package:artifact2.jar:1.1.0
Downloading from nexus-repository-2: https://nexus2.completely.other.net/repository/maven-public/your/second/package/artifact2/1.1.0/artifact2.jar (14 kB at 305 kB/s)
In settings.xml, defining mirror with id and url for the repository besides using the same in profile worked for me, as below:
<mirrors>
<mirror>
<id>Artifactory</id>
<url>http://localhost:4900/archiva/repository/</url>
<mirrorOf>artifactory</mirrorOf>
</mirror>
<mirror>
<id>MavenCentral</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>Project</id>
<properties>
<framework.version>1.0.9</framework.version>
<maven.test.skip>false</maven.test.skip>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
<maven.javadoc.skip>false</maven.javadoc.skip>
<source.jdkversion>1.8</source.jdkversion>
<target.jdkversion>1.8</target.jdkversion>
</properties>
<repositories>
<repository>
<id>Artifactory</id>
<name>Maven Artifactory for Project</name>
<url>http://localhost:4900/archiva/repository/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<id>MavenCentral</id>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
</profile>
</profiles>
It's impossible to specify a dedicated repository to look up an artifact. Maven will look up all configured repositories one by one until the artifact is found. Just add both the central mirror and internal repository to the settings.xml and it will be okay.
Read Maven guide to setup multiple repositories. In respect to the order of repositories, see this answer.
In the settings.xml, you need to make 3 changes
(Replace https://repository.internal/mvn-public/ with your org internal repo url)
A) Add the mirrors as below
<mirror>
<mirrorOf>artifact-int</mirrorOf>
<url>https://repository.internal/mvn-public/</url>
<id>artifact-int-mirror</id>
<name>internal Repository</name>
</mirror>
<mirror>
<mirrorOf>artifact-web</mirrorOf>
<url>https://repo1.maven.org/maven2/</url>
<id>artifact-web-mirror</id>
<name>Amadeus Repository</name>
</mirror>
B) Update the profile section as below
<profiles>
<profile>
<id>artifact.repository.int</id>
<repositories>
<repository>
<id>artifact-int</id>
<name>Internal Artifactory</name>
<url>https://repository.internal/mvn-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>artifact-int</id>
<name>Int Artifactory</name>
<url>https://repository.internal/mvn-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>artifact.repository.web</id>
<repositories>
<repository>
<id>artifact-web</id>
<name>Web Artifactory</name>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>artifact-web</id>
<name>Web Artifactory</name>
<url>https://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
C) Set the active profile as below
<activeProfiles>
<activeProfile>artifact.repository.int</activeProfile>
<activeProfile>artifact.repository.web</activeProfile>
</activeProfiles>
Define (duplicate) authentication (server) entries in settings.xml,
<servers>
<server>
<id>auth-default</id>
<username>${env.ARTIFACTORY_USER}</username>
<password>${env.ARTIFACTORY_PASS}</password>
</server>
<server>
<id>auth-libs-release-art</id>
<username>${env.ARTIFACTORY_USER}</username>
<password>${env.ARTIFACTORY_PASS}</password>
</server>
[...]
</servers>
Define respective mirrors with a special "catch-the-rest" in mirrorOf for the main repository and references to "repository" IDs in the other mirrorOf entries.
<mirrors>
<mirror>
<id>auth-default</id>
<url>https://artifactory.COMPANY.net/artifactory/repo.maven.apache.org</url>
<mirrorOf>*,!libs-release,[...]</mirrorOf>
</mirror>
<mirror>
<id>auth-libs-release-art</id>
<url>https://artifactory.COMPANY.net/artifactory/libs-release</url>
<mirrorOf>libs-release</mirrorOf>
</mirror>
[...]
</mirrors>
Define repositories with "example" URLs (the URLs will be ignored because of using the above mirrors; reusing the server IDs in the repository IDs and placing the real URLs directly in the repository entries will prevent from using the indirection via mirror definitions).
<profiles>
<profile>
<id>libs-art</id>
<repositories>
<repository>
<id>libs-release</id>
<releases><enabled>true</enabled><updatePolicy>never</updatePolicy></releases>
<url>https://example.test/libs-release</url>
</repository>
<repository>
<id>libs-snapshot</id>
<snapshots />
<url>https://example.test/libs-snapshot</url>
</repository>
[...]
</profile>
</profiles>
<activeProfiles>
<activeProfile>libs-art</activeProfile>
</activeProfiles>

Maven not find dependency in Nexus

My pom file for the project has the following distribution management tag
<distributionManagement>
<repository>
<id>confiz-repo</id>
<url>http://10.10.10.230:8081/nexus/content/repositories/snapshots/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</distributionManagement>
i use mvn deploy and that gives me a success. So i know my artifact has been deployed successfully. Now my settings.xml file is as follows
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>confiz-repo</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<!-- The id of this mirror and the server instance above needs to be the same!-->
<id>confiz-repo</id>
<mirrorOf>*</mirrorOf>
<url> http://10.10.10.230:8081/nexus/content/groups/public/</url>
</mirror>
<mirror>
<!-- The id of this mirror and the server instance above needs to be the same!-->
<id>confiz-repo</id>
<mirrorOf>*</mirrorOf>
<url> http://10.10.10.230:8081/nexus/content/repositories/snapshots/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>confiz-repo</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>confiz-repo</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
Now when i include the dependency for the first project into my second project and run mvn clean install maven complains
[ERROR] Failed to execute goal on project merchant: Could not resolve dependencies for project com.onestopspot:merchant:apk:1.0.1-SNAPSHOT: Could not find artifact com.confiz.abc:my-artifact:jar:1.0-SNAPSHOT in confiz-repo (http://10.10.10.230:8081/nexus/content/groups/public/) -> [Help 1]
what am i doing wrong ?
EDIT - I can see my artifact deployed in nexus. So i am right in saying that the mvn deploy works correctly. But the path http://10.10.10.230:8081/nexus/content/groups/public/ from which nexus is trying to read does not contain my artifact.
Your second project is trying to grab artifact of first project from nexus which isn't exist there
You might want to deploy snapshot on nexus
If you don't want to do 1. run mvn clean install -o on second project in offline mode

Categories