I am using Redhat
, java 1.7
, maven 3.2.5
, jenkins 1.6
,git version 2.0.5
and nexus-2.12.0-01
I have created a Local Nexus Repository
for my internal development.
Now What I am trying to do is, to build maven
project using jenkins
with Nexus Repository Manger Oss
.
I am able to build my project without Nexus Repository Manger Oss
.
Note : I am using parent pom
since I have to sub projects.
Below are the steps that I followed.
Installed
Nexus Repository Manger Oss
. It is up and running
here is screen-shot.Installed ojdbc5 jar in nexus repository
- Made necessary changes in setting.xml file of .m2 folder
here the content of setting.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 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://maven.apache.org</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://maven.apache.org</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<servers>
<server>
<id>releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
</settings>
- Added the details of nexus repository in my
pom.xml
parent pom.xml
content
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>parent</groupId>
<artifactId>A</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Maven Webapp</name>
<!--url>http://maven.apache.org</url-->
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/content/repositories/thirdparty/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc5</artifactId>
<version>11.2.0.1</version>
</dependency>
</dependencies>
<modules>
<module>subModule1</module>
<module>subModule2</module>
</modules>
</project>
subModule1's pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.a</groupId>
<artifactId>a</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven Webapp</name>
<distributionManagement>
<repository>
<id>releases</id>
<!-- CHANGE HERE by your team nexus server -->
<url>http://localhost:8081/nexus/content/repositories/thirdparty/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<!-- CHANGE HERE by your team nexus server -->
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
// dependecies are defined here
<dependencies>
In subModule1 and subModule2 I have added the distributionManagement
section.
But when I build my project I get the below error.
[ERROR] Failed to execute goal on project submodule1: Could not resolve dependencies for project submodule1:war:1.0-SNAPSHOT: Failure to find com.oracle:ojdbc5:jar:11.2.0.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
I understand the error is caused by the com.oracle:ojdbc5:jar:11.2.0.1
jar dependency not being resolvable.
But I am surprised why it is not picking it up from my local nexus repository.
Have I missed any configuration, or am I doing it in a wrong way?
How do I use local nexus repository for my projects?