Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Can't resolve an artifact programatically

Thanks Benjamin for you quick answer.

Indeed the repository definition is not correct, but only internally. If
I look at my settings.xml (referenced by Preferences>Maven>User
Settings) it is very much like the recommended settings you pointed to
me:
   <mirrors>
      <mirror>
         <id>odyssey-group.com</id>
         <name>Odyssey Maven Repository</name>
         <url>http://maven.oams.com/content/groups/odyssey</url>
         <mirrorOf>*</mirrorOf>
      </mirror>
   </mirrors>

	<profiles>
		<profile>
			<id>DefaultRepository</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<repositories>
				<repository>
					<id>odyssey-group.com</id>
					<name>Odyssey Maven
Repository</name>
	
<releases><enabled>true</enabled></releases>
	
<snapshots><enabled>true</enabled></snapshots>
	
<url>http://maven.oams.com/content/groups/odyssey</url>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>odyssey-group.com</id>
					<name>Odyssey Maven
Repository</name>
	
<releases><enabled>true</enabled></releases>
	
<snapshots><enabled>true</enabled></snapshots>
	
<url>http://maven.oams.com/content/groups/odyssey</url>
				</pluginRepository>
			</pluginRepositories>
		</profile>
	</profiles>
</settings>

Additionally, I tried to change it at runtime to test the download
behavior:
ArtifactRepositoryPolicy policy =
MavenPlugin.getDefault().getMaven().getArtifactRepositories().get(0).get
Snapshots();
policy.setEnabled(true);
MavenPlugin.getDefault().getMaven().getArtifactRepositories().get(0).set
SnapshotUpdatePolicy(policy);

But right after the last line is executed,
MavenPlugin.getDefault().getMaven().getArtifactRepositories().get(0).get
Snapshots().isEnabled() still returns false (and the download doesn't
occur).

I checked also my m2e maven settings, and maven is not set Offline
(Preferences>Maven>Offline unchecked)

Any idea?

Yann

-----Original Message-----
From: m2e-users-bounces@xxxxxxxxxxx
[mailto:m2e-users-bounces@xxxxxxxxxxx] On Behalf Of Benjamin Bentmann
Sent: Tuesday, July 19, 2011 10:02 AM
To: Maven Integration for Eclipse users mailing list
Subject: Re: [m2e-users] Can't resolve an artifact programatically

Yann Andenmatten wrote:

>        Artifact artifact = 
> MavenPlugin.getDefault().getMaven().resolve(
>
>              STARTER_GROUP_ID, STARTER_ARTIFACT_ID, snapshotVersion, 
> [...] The 
> MavenPlugin.getDefault().getMaven().getArtifactRepositories() call 
> return one remote repository:
>
> [       id: odyssey-group.com
>        url: http://maven.oams.com/content/groups/odyssey
>     layout: default
> snapshots: [enabled =>  false, update =>  daily]
> releases: [enabled =>  true, update =>  daily]

If you are trying to resolve a snapshot artifact, you need to set
  snapshots.enabled=true
on the used remote repository. In case of a mirror, this means one of
the mirrored remote repos must have the required snapshot policy, see
[0] as an example that overrides "central" accordingly.



Benjamin


[0]
http://www.sonatype.com/books/nexus-book/reference/maven-sect-single-gro
up.html
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
The information in this e-mail and any attachments is confidential and may be legally privileged. 
It is intended solely for the addressee or addressees. Any use or disclosure of the contents 
of this e-mail/attachments by a not intended recipient is unauthorized and may be unlawful. 
If you have received this e-mail in error please notify the sender. 
Please note that any views or opinions presented in this e-mail are solely those of the author and 
do not necessarily represent those of TEMENOS. 
We recommend that you check this e-mail and any attachments against viruses. 
TEMENOS accepts no liability for any damage caused by any malicious code or virus transmitted by this e-mail.



Back to the top