You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@archiva.apache.org by "DEGARDIN David (CAMPUS)" <da...@oxylane-group.com> on 2009/02/02 14:22:22 UTC

Archiva & Snapshots

Hi,

I've got a question about Archiva and snapshots. I've got a project
(let's call him A) that has a dependency on another artefact (let's call
him B) that is still in development phase.
I've uploaded my artefact B in version 1.1-SNAPHOST with Archiva. When I
look in the folder where the artefact should be deployed, I see that a
folder 1.1-SNAPSHOT has been created (so far, it is OK). In this folder,
the artifact is named myproject-1.1-20090130xxxxx (the qualifier and
build number). Same thing for its pom.

When I look for this artifact with Archiva search form, I cannot find
the 1.1-SNAPSHOT version but the 1.1-20090130xxxxx one.

How am I suppposed to declare this dependency in my project A ? I've
tried:

	<dependency>
		<groupId>toto</groupId>
		<artifactId>B</artifactId>
		<version>1.1-SNAPSHOT</version>
	</dependency>

Or:
	<dependency>
		<groupId>toto</groupId>
		<artifactId>B</artifactId>
		<version>SNAPSHOT</version>
	</dependency>

And even:
	<dependency>
		<groupId>toto</groupId>
		<artifactId>B</artifactId>
		<version>1.1-20090130xxxxx</version>
	</dependency>

My mvn command always says that there is a missing resource, the
artefact cannot be found.

So my question is: am I doing the right thing ? I mean, is it possible
to upload an artefact that is in SNAPSHOT version with Archiva ?

Note that Archiva is configured with "snapshots included" and "delete
released snapshots" flags set to true.

Please advise me. I just need to know if this is OK and how to use it.
Do not hesitate to ask me more if it is not clear enough.

Thanks a lot

David

Re: Archiva & Snapshots

Posted by Wendy Smoak <ws...@gmail.com>.
I'd advise putting the mirror with mirrorOf * back in, to prevent any
access to external repos.  In addition to that, put another mirror for
your snapshots repo.  The * is a catch-all.  If another mirror
matches, that will be used instead.

Another way to reduce configuration is to create a repository group (I
usually call mine 'all') and add all your repos to it.  Then you can
use that single (virtual) repository as a mirror for everything.

[1] http://maven.apache.org/guides/mini/guide-mirror-settings.html

-- 
Wendy

On Mon, Feb 9, 2009 at 1:32 AM, DEGARDIN David (CAMPUS)
<da...@oxylane-group.com> wrote:
> Hi Wendy,
>
> Thank you very much for your help on this.
> With your help, I managed to do it: I had to declare a profile with 2
> repositories: the one with releases and the one with snapshots (this
> profile is always activated for all builds).
>
> But I had to remove the mirror part (before, in my settings.xml file, I
> had archiva as a mirror of *). If I leave the mirror part, the snapshot
> is not found (maven is trying to retrieve it from the "internal"
> repository which is the one that is defined in mirror part).
>
> David

RE: Archiva & Snapshots

Posted by "DEGARDIN David (CAMPUS)" <da...@oxylane-group.com>.
Hi Wendy,

Thank you very much for your help on this.
With your help, I managed to do it: I had to declare a profile with 2
repositories: the one with releases and the one with snapshots (this
profile is always activated for all builds).

But I had to remove the mirror part (before, in my settings.xml file, I
had archiva as a mirror of *). If I leave the mirror part, the snapshot
is not found (maven is trying to retrieve it from the "internal"
repository which is the one that is defined in mirror part).

David

-----Original Message-----
From: Wendy Smoak [mailto:wsmoak@gmail.com] 
Sent: Monday, February 02, 2009 8:50 PM
To: users@archiva.apache.org
Subject: Re: Archiva & Snapshots

On Mon, Feb 2, 2009 at 7:23 AM, DEGARDIN David wrote:

> I thought it was something like this but when I looked into those 
> files, it seems correct to me (but I let you tell if it's OK).
>
> So, at the artifact level:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <metadata>
>  <groupId>myproject</groupId>
>  <artifactId>B</artifactId>
>  <versioning>
>    <latest>1.1-SNAPSHOT</latest>
>    <release>1.0</release>

This indicates you have releases and snapshots in the same repository,
which is unusual (unless this is a repo group aggregating multiple
repositories?  That doesn't appear to be the case, from the 'internal'
repo id I saw earlier in your build output.)

If you want to combine releases and snapshots in the 'internal' repo,
make sure you have Maven configured to retrieve snapshots from that
repo.  Check your <repository> and <pluginRepository> in settings.xml
(or in the pom) and make sure you have NOT added
<snapshots><enabled>false to it.

I'd suggest deploying snapshots to a separate 'snapshots' directory and
keeping 'internal' for releases only.

If it's still not working, paste your <repository> and
<pluginRepository> elements for your repo(s).

--
Wendy

Re: Archiva & Snapshots

Posted by Wendy Smoak <ws...@gmail.com>.
On Mon, Feb 2, 2009 at 7:23 AM, DEGARDIN David (CAMPUS)
<da...@oxylane-group.com> wrote:

> I thought it was something like this but when I looked into those files,
> it seems correct to me (but I let you tell if it's OK).
>
> So, at the artifact level:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <metadata>
>  <groupId>myproject</groupId>
>  <artifactId>B</artifactId>
>  <versioning>
>    <latest>1.1-SNAPSHOT</latest>
>    <release>1.0</release>

This indicates you have releases and snapshots in the same repository,
which is unusual (unless this is a repo group aggregating multiple
repositories?  That doesn't appear to be the case, from the 'internal'
repo id I saw earlier in your build output.)

If you want to combine releases and snapshots in the 'internal' repo,
make sure you have Maven configured to retrieve snapshots from that
repo.  Check your <repository> and <pluginRepository> in settings.xml
(or in the pom) and make sure you have NOT added
<snapshots><enabled>false to it.

I'd suggest deploying snapshots to a separate 'snapshots' directory
and keeping 'internal' for releases only.

If it's still not working, paste your <repository> and
<pluginRepository> elements for your repo(s).

-- 
Wendy

RE: Archiva & Snapshots

Posted by "DEGARDIN David (CAMPUS)" <da...@oxylane-group.com>.
Hi Wendy,

I thought it was something like this but when I looked into those files,
it seems correct to me (but I let you tell if it's OK).

So, at the artifact level:
<?xml version="1.0" encoding="UTF-8"?>

<metadata>
  <groupId>myproject</groupId>
  <artifactId>B</artifactId>
  <versioning>
    <latest>1.1-SNAPSHOT</latest>
    <release>1.0</release>
    <versions>
      <version>1.0</version>
      <version>1.1-SNAPSHOT</version>
    </versions>
    <lastUpdated>20090202134142</lastUpdated>
  </versioning>
</metadata>


At the version level: 
<?xml version="1.0" encoding="UTF-8"?>

<metadata>
  <groupId>myproject</groupId>
  <artifactId>B</artifactId>
  <version>1.1-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <buildNumber>1</buildNumber>
      <timestamp>20090202.134142</timestamp>
    </snapshot>
    <lastUpdated>20090202134142</lastUpdated>
  </versioning>
</metadata>


About this:
> If 'B' is your own project, and this is your internal snapshots repo,
the best way to get it into the repo is to configure
distributionManagement and 
> then execute 'mvn deploy'.
I'd like to but the artifact contains a very specific part during build
process and I still build it with an Ant script (I did not find the time
yet to manage it with a POM).

Do you know what is this error:
"Caused by:
org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException"

Why is maven telling about multiple artifacts ?

David

-----Original Message-----
From: Wendy Smoak [mailto:wsmoak@gmail.com] 
Sent: Monday, February 02, 2009 3:13 PM
To: users@archiva.apache.org
Subject: Re: Archiva & Snapshots

On Mon, Feb 2, 2009 at 6:51 AM, DEGARDIN David (CAMPUS) wrote:
> Hello Wendy,
>
> I've used the upload form (upload.action page). I've specified toto as

> groupId, B as artifactId and 1.1-SNAPSHOT as version. I've tried two
> ways:
>        1) tell Archiva to generate the POM
>        2) give Archiva a POM already written

If 'B' is your own project, and this is your internal snapshots repo,
the best way to get it into the repo is to configure
distributionManagement and then execute 'mvn deploy'.

I suspect that Archiva isn't getting the metadata correct when you
upload a snapshot, and then Maven can't find it.

Can you paste the contents of the maven-metadata.xml files near your
uploaded snapshot?  They should look similar to these:

At the artifact level:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/continuu
m/continuum-core/maven-metadata.xml

At the version level:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/continuu
m/continuum-core/1.2.4-SNAPSHOT/maven-metadata.xml

--
Wendy

Re: Archiva & Snapshots

Posted by Wendy Smoak <ws...@gmail.com>.
On Mon, Feb 2, 2009 at 6:51 AM, DEGARDIN David (CAMPUS)
<da...@oxylane-group.com> wrote:
> Hello Wendy,
>
> I've used the upload form (upload.action page). I've specified toto as
> groupId, B as artifactId and 1.1-SNAPSHOT as version. I've tried two
> ways:
>        1) tell Archiva to generate the POM
>        2) give Archiva a POM already written

If 'B' is your own project, and this is your internal snapshots repo,
the best way to get it into the repo is to configure
distributionManagement and then execute 'mvn deploy'.

I suspect that Archiva isn't getting the metadata correct when you
upload a snapshot, and then Maven can't find it.

Can you paste the contents of the maven-metadata.xml files near your
uploaded snapshot?  They should look similar to these:

At the artifact level:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/continuum/continuum-core/maven-metadata.xml

At the version level:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/continuum/continuum-core/1.2.4-SNAPSHOT/maven-metadata.xml

-- 
Wendy

RE: Archiva & Snapshots

Posted by "DEGARDIN David (CAMPUS)" <da...@oxylane-group.com>.
Hello Wendy,

I've used the upload form (upload.action page). I've specified toto as
groupId, B as artifactId and 1.1-SNAPSHOT as version. I've tried two
ways:
	1) tell Archiva to generate the POM 
	2) give Archiva a POM already written

To test it, I've got a local repository with Archiva as a mirror of *.
I'm sure this configuration works as I've managed to download from
remote repository an artifact.

So I have a pom.xml with this piece of XML:
        <dependency>
                <groupId>myproject</groupId>
                <artifactId>B</artifactId>
                <version>1.1-SNAPSHOT</version>
        </dependency>

I launch Maven2 in a cmd window and I launch the "mvn clean install"
command. I got this message:

[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building Downloader POM
[INFO]    task-segment: [clean, install]
[INFO]
------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) myproject:B:jar:1.1-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=myproject -DartifactId=B
-Dversion
=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file
there:

      mvn deploy:deploy-file -DgroupId=myproject -DartifactId=B
-Dversion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url]
-DrepositoryId=[i
d]

  Path to dependency:
        1) blabla:A:jar:1.0-SNAPSHOT
        2) myproject:B:jar:1.1-SNAPSHOT

----------
1 required artifact is missing.

for artifact:
  blabla:A:jar:1.0-SNAPSHOT

from the specified remote repositories:
  archiva.default (http://myarchiva/repository/internal)


[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Mon Feb 02 14:43:21 CET 2009
[INFO] Final Memory: 4M/8M
[INFO]
------------------------------------------------------------------------



More details with the -e switch (the error sounds quite strange, I do
not understand it):

  at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:575)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:499)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:478)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:330)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:291)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:142)
        at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by:
org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException
        at
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTra
nsitively(DefaultArtifactResolver.java:324)
        at
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTra
nsitively(DefaultArtifactResolver.java:288)
        at
org.apache.maven.plugin.DefaultPluginManager.resolveTransitiveDepende
ncies(DefaultPluginManager.java:1415)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:405)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:558)
        ... 16 more

I'm using 1.1.3 version of Archiva.

David

-----Original Message-----
From: Wendy Smoak [mailto:wsmoak@gmail.com] 
Sent: Monday, February 02, 2009 2:35 PM
To: users@archiva.apache.org
Subject: Re: Archiva & Snapshots

On Mon, Feb 2, 2009 at 6:22 AM, DEGARDIN David (CAMPUS)
<da...@oxylane-group.com> wrote:

> I've uploaded my artefact B in version 1.1-SNAPHOST with Archiva. When

> I look in the folder where the artefact should be deployed, I see that

> a folder 1.1-SNAPSHOT has been created (so far, it is OK). In this 
> folder, the artifact is named myproject-1.1-20090130xxxxx (the 
> qualifier and build number). Same thing for its pom.

How did you upload the jar and pom to Archiva?

>        <dependency>
>                <groupId>toto</groupId>
>                <artifactId>B</artifactId>
>                <version>1.1-SNAPSHOT</version>
>        </dependency>

This should work (as should the one with the full timestamped version
number, if you wanted to lock down to a particular snapshot.)

Can you paste the command you're running and the exact error you're
seeing?   Also let us know, what version of Archiva.

--
Wendy

Re: Archiva & Snapshots

Posted by Wendy Smoak <ws...@gmail.com>.
On Mon, Feb 2, 2009 at 6:22 AM, DEGARDIN David (CAMPUS)
<da...@oxylane-group.com> wrote:

> I've uploaded my artefact B in version 1.1-SNAPHOST with Archiva. When I
> look in the folder where the artefact should be deployed, I see that a
> folder 1.1-SNAPSHOT has been created (so far, it is OK). In this folder,
> the artifact is named myproject-1.1-20090130xxxxx (the qualifier and
> build number). Same thing for its pom.

How did you upload the jar and pom to Archiva?

>        <dependency>
>                <groupId>toto</groupId>
>                <artifactId>B</artifactId>
>                <version>1.1-SNAPSHOT</version>
>        </dependency>

This should work (as should the one with the full timestamped version
number, if you wanted to lock down to a particular snapshot.)

Can you paste the command you're running and the exact error you're
seeing?   Also let us know, what version of Archiva.

-- 
Wendy