0

I have set up Apache Archiva and added a couple of files to it:

enter image description here

enter image description here

Everything looks good, I think.

I have updated my settings.xml file to include the profile:

enter image description here

I then add the above mentioned dependency to my pom.xml file:

enter image description here

I save it so that it rebuilds and then bam!

enter image description here

Please, for the love of all that is good in this world can someone tell me what I'm not doing correctly?

The error message actually reads:

enter image description here

Changed snapshots to "true" and adding screenshot.

enter image description here

Anton
  • 761
  • 17
  • 40
  • 1
    The dependencies and the error listed doesn't co-relate. Also in yout settings.xml, `` `` should be `true` if you are trying to keep SNAPSHOT for your artifacts in the repository. – Naman Jan 03 '17 at 15:51
  • @nullpointer added screen shot with the current error message. Any help is GREATLY appreciated. – Anton Jan 03 '17 at 16:00
  • Try using true for snapshots and also could you try executing `mvn clean install` and post the relevant failure logs in the questions instead of the error screenshot. – Naman Jan 03 '17 at 16:04
  • @nullpointer, changed snapshots to "true" and added screen shot. – Anton Jan 03 '17 at 16:13
  • Do you need credentials to access your repo? If so then you'll need a section in your settings. Also, you may need a too. Perhaps you could run `mvn -X clean install`... – Software Engineer Jan 03 '17 at 17:52
  • @EngineerDollery, I've added my personal credentials to the portion of the settings.xml file. Still can't reach the Archiva server. – Anton Jan 03 '17 at 19:20

1 Answers1

4

Making the connection between Apache Archiva and Maven was a difficult slog.

I eventually stumbled across another post here on Stack that was a tremendious help in figuring this out. For the life of me I can't seem to find again to give proper credit. If I eventually find it again I will post so you can get that sweet sweet karma.

Here is my settings.xml file:

<?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>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>myproxyserver.name.org</host>
        <port>8080</port>
        <nonProxyHosts>localhost|myserver</nonProxyHosts>
     </proxy>
</proxies>

<servers>
    <server>
        <id>my.snapshots</id>
    </server>
</servers>

<mirrors>
    <mirror>
        <id>Central</id>
        <url>http://repo.maven.apache.org/maven2</url>
        <mirrorOf>my.snapshots</mirrorOf>
    </mirror>
    <mirror>
        <id>archiva.default</id>
        <mirrorOf>Central</mirrorOf>
        <url>http://myserver:8080/repository/internal/</url>
    </mirror>
    <mirror>
        <id>my.snapshots</id>
        <mirrorOf>Central</mirrorOf>
        <url>http://myserver:8080/repository/snapshots</url>
    </mirror>
</mirrors>

<profiles>
    <profile>
        <id>internal</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>archiva.internal</id>
                <name>Archiva Managed Internal Repository</name>
                <url>http://myserver:8080/repository/internal/</url>
                <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
                <snapshots><enabled>false</enabled></snapshots>
            </repository>
            <repository>
                <id>archiva.snapshots</id>
                <name>Archiva Managed Internal Repository</name>
                <url>http://myserver:8080/repository/snapshots/</url>
                <releases><enabled>false</enabled></releases>
                <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
            </repository>
        </repositories>
    </profile>
</profiles>

<activeProfiles>
    <activeProfile>internal</activeProfile>
</activeProfiles>

I understand that this may not be the most efficient layout but it finally worked. If anyone has any recommendations to make this more concise please feel free to chime in.

Update on June 20, 2018:

My organization just switched to ProGet for our artifact server. It's significantly easier to use compared to Apache Archiva.

The settings.xml file for ProGet is as follows:

<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>optional</id>
            <active>true</active>
            <protocol>http</protocol>
            <host>mycompany.ourproxy.org</host>
            <port>8080</port>
            <nonProxyHosts>localhost|servernamewhereProGetlives</nonProxyHosts>
        </proxy>
    </proxies>

    <mirrors>
        <mirror>
            <id>ProGet</id>
            <url>http://servernamewhereProGetlives/maven/</url>
            <mirrorOf>*,!central</mirrorOf>
        </mirror>
    </mirrors>
</settings>

Then of course don't forget to reference the repository in your projects' pom file.

<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>myproject</groupId>
    <artifactId>something</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>ProGet</id>
            <name>My Site - ProGet</name>
            <url>https://myserver.org/feeds</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <artifactId>something</artifactId>
            <groupId>something-something-whatever</groupId>
            <version>1.1.3</version>
        </dependency>
    </dependencies>
</project>

I hope this helps whoever is researching this stuff. Good luck!

Anton
  • 761
  • 17
  • 40
  • @MauricePerry, I'm sorry I don't understand your question. What are you asking? – Anton Feb 21 '17 at 13:57
  • the post you said you stumbled across – Maurice Perry Feb 23 '17 at 06:47
  • @MauricePerry, I haven't been able to find it again though I must confess that I haven't been looking too terribly hard. – Anton May 09 '17 at 16:00
  • 1
    Thanks alot. I just needed the two definitions inside my Archiva-Profile. Now my Snapshot packages show up in the web ui an I can download them there. Archiva looks fantastic. And it seems to be able to communicate with maven 3 – JackLeEmmerdeur Nov 29 '20 at 03:18