-
-
Save skyrocknroll/5116678 to your computer and use it in GitHub Desktop.
An adventure into archiva and maven
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download archiva from http://archiva.apache.org/download.cgi | |
extract it to /opt/archiva/ | |
cd /opt/archiva/bin | |
./archiva start | |
thats it :) | |
access it http://server-ip:8080/archiva or | |
http://server-ip:8080/ for archiva 1.4 onwards | |
to make the client to use the repo edit $M2_HOME/conf/settings.xml | |
and add this stuff inside <mirrors> tag | |
<mirror> | |
<id>archiva.central</id> | |
<url>http://192.168.1.7:8081/archiva/repository/internal</url> | |
<mirrorOf>central</mirrorOf> | |
</mirror> | |
if you run archive latest 1.4 M3 then url may change to | |
<url>http://192.168.1.7:8081/repository/internal</url> | |
this will proxy the requests only for maven central repo | |
to proxy all the requests change from | |
<mirrorOf>central</mirrorOf> | |
to | |
<mirrorOf>*<mirrorOf> | |
Eclipse _ M2 eclipse Gotchas | |
Even after configuring settings.xml eclipse wont fetch artifacts from proxy, | |
Because eclipse is using its own settingfile from /home/yuva/.m2/settings.xml | |
to fix this we need goto ->> | |
Window--> preference-->(search for maven) --> user settings --> user settings --> browse -- | |
select the $M2_HOME/conf/settings.xml | |
==== Now Lets start uploading our internal artifact to our internal archiva repo ===== | |
Publishing artifacts with sources on archiva | |
http://stackoverflow.com/questions/1072969/publishing-artifacts-with-sources-on-archiva | |
How to create jar archive of projects sources with maven | |
http://stackoverflow.com/questions/11628968/how-to-create-jar-archive-of-projects-sources-with-maven | |
while uploading the jar artifact genreate the source of the artifact by using following command mvn sources:jar (For this to work you should have included maven sources plugin in the pom.xml) | |
=================TroubleShooting ==================== | |
If artifacts are not downloading from the out local archiva. | |
please provide a valid settings file in eclipse m2e windows-->Preferences-->Maven-->userSettings --> User Settings | |
Description Resource Path Location Type | |
ArtifactDescriptorException: Failed to read artifact descriptor for commons-lang:commons-lang:jar:2.6: ArtifactResolutionException: Failure to transfer commons-lang:commons-lang:pom:2.6 from http://10.30.0.127:8080/repository/internal was cached in the local repository, resolution will not be reattempted until the update interval of archiva.central has elapsed or updates are forced. Original error: Could not transfer artifact commons-lang:commons-lang:pom:2.6 from/to archiva.central (http://10.30.0.127:8080/repository/internal): Failed to transfer http://10.30.0.127:8080/repository/internal/commons-lang/commons-lang/2.6/commons-lang-2.6.pom. Error code 500, Unable to fetch artifact resource. pom.xml /url-app line 1 Maven Dependency Problem | |
Then goto archiva web console --> Proxy Connectors --> click the edit of internal --> Releases -->Drop Down --> always | |
If artifacts are not downloading then check the reports . | |
http://10.30.0.127/#reports | |
It may contain what is missing | |
eg: | |
com.xxx.monitoring.uptime.client uptime-client 0.2 com.xxx.monitoring.uptime.client/uptime-client/0.2 missing-pom The artifact's POM file '/opt/archivajs14M3/repositories/data/repositories/internal/com/xxx/monitoring/uptime/client/uptime-client/0.2/uptime-client-0.2.pom' was missing | |
To upload sources jar also along with artifacts jar add the following snippet to pom.xml | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-source-plugin</artifactId> | |
<version>2.4</version> | |
<executions> | |
<execution> | |
<goals> | |
<goal>jar-no-fork</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<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/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.minjar</groupId> | |
<artifactId>simplify-core</artifactId> | |
<packaging>jar</packaging> | |
<version>0.1.0</version> | |
<name>simplify-core</name> | |
<properties> | |
<slf4j.version>1.6.4</slf4j.version> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>3.1</version> | |
<configuration> | |
<source>1.6</source> | |
<target>1.6</target> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-source-plugin</artifactId> | |
<version>2.4</version> | |
<executions> | |
<execution> | |
<goals> | |
<goal>jar-no-fork</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<dependencies> | |
<dependency> | |
<groupId>ca.juliusdavies</groupId> | |
<artifactId>not-yet-commons-ssl</artifactId> | |
<version>0.3.11</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.commons</groupId> | |
<artifactId>commons-lang3</artifactId> | |
<version>3.1</version> | |
</dependency> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>slf4j-api</artifactId> | |
<version>${slf4j.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>jcl-over-slf4j</artifactId> | |
<version>${slf4j.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>slf4j-log4j12</artifactId> | |
<version>${slf4j.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.httpcomponents</groupId> | |
<artifactId>httpclient</artifactId> | |
<version>4.0-alpha2</version> | |
</dependency> | |
<dependency> | |
<groupId>log4j</groupId> | |
<artifactId>log4j</artifactId> | |
<version>1.2.14</version> | |
</dependency> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>4.0</version> | |
</dependency> | |
<dependency> | |
<groupId>commons-configuration</groupId> | |
<artifactId>commons-configuration</artifactId> | |
<version>1.8</version> | |
</dependency> | |
<dependency> | |
<groupId>org.codehaus.jackson</groupId> | |
<artifactId>jackson-core-asl</artifactId> | |
<version>1.8.7</version> | |
</dependency> | |
<dependency> | |
<groupId>org.codehaus.jackson</groupId> | |
<artifactId>jackson-mapper-asl</artifactId> | |
<version>1.8.7</version> | |
</dependency> | |
<dependency> | |
<groupId>com.metaparadigm</groupId> | |
<artifactId>json-rpc</artifactId> | |
<version>1.0</version> | |
</dependency> | |
</dependencies> | |
<repositories> | |
<repository> | |
<id>archiva.internal</id> | |
<name>Archiva Managed Internal Repository</name> | |
<url>http://repo.botmetric.com/repository/internal/</url> | |
<releases> | |
<enabled>true</enabled> | |
</releases> | |
<snapshots> | |
<enabled>false</enabled> | |
</snapshots> | |
</repository> | |
</repositories> | |
<distributionManagement> | |
<repository> | |
<id>archiva.internal</id> | |
<name>Internal Release Repository</name> | |
<url>http://repo.botmetric.com/repository/internal/</url> | |
</repository> | |
<snapshotRepository> | |
<id>archiva.snapshots</id> | |
<name>Internal Snapshot Repository</name> | |
<url>http://repo.botmetric.com/repository/snapshots/</url> | |
</snapshotRepository> | |
</distributionManagement> | |
</project> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<settings> | |
<!-- omitted xml --> | |
<mirrors> | |
<!-- We are saying that archiva.internal also acts as mirror for central --> | |
<mirror> | |
<id>archiva.internal</id> | |
<url>http://repo.botmetric.com/repository/internal</url> | |
<mirrorOf>central</mirrorOf> | |
</mirror> | |
</mirrors> | |
<servers> | |
<server> | |
<!-- sets the password where ever id is equal to archiva.internal i think we can use * for id also --> | |
<id>archiva.internal</id> | |
<username>test</username> | |
<password>t3st</password> | |
</server> | |
<server> | |
<id>archiva.snapshots</id> | |
<username>test</username> | |
<password>t3st</password> | |
</server> | |
<!-- omitted xml --> | |
</servers> | |
<!-- omitted xml --> | |
</settings> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment