Author: gscokart
Date: Wed Nov 21 06:00:41 2007
New Revision: 597090
URL: http://svn.apache.org/viewvc?rev=597090&view=rev
Log:
Handle also relocation for artefactId and version number (IVY-586)
Added:
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3full/
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3full/1.1/
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3full/1.1/test3full-1.1.pom
(with props)
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=597090&r1=597089&r2=597090&view=diff
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
Wed Nov 21 06:00:41 2007
@@ -155,6 +155,10 @@
private StringBuffer buffer = new StringBuffer();
+ private String relocationModule;
+
+ private String relocationRevision;
+
public Parser(ModuleDescriptorParser parser, Resource res) {
super(parser);
setResource(res);
@@ -288,8 +292,17 @@
} else if
("project/distributionManagement/relocation".equals(context)) {
md.setModuleRevisionId(ModuleRevisionId
.newInstance(organisation, module, revision));
+ if (relocationOrganisation == null ) {
+ relocationOrganisation = organisation;
+ }
+ if (relocationModule == null ) {
+ relocationModule = module;
+ }
+ if (relocationRevision == null ) {
+ relocationRevision = revision;
+ }
dd = new DefaultDependencyDescriptor(md,
ModuleRevisionId.newInstance(
- relocationOrganisation, module, revision), true, false,
true);
+ relocationOrganisation, relocationModule,
relocationRevision), true, false, true);
dd.addDependencyConfiguration("*", "@");
md.addDependency(dd);
dd = null;
@@ -331,7 +344,15 @@
return;
}
if
(context.equals("project/distributionManagement/relocation/groupId")) {
- relocationOrganisation = txt;
+ relocationOrganisation= txt;
+ return;
+ }
+ if
(context.equals("project/distributionManagement/relocation/artifactId")) {
+ relocationModule = txt;
+ return;
+ }
+ if
(context.equals("project/distributionManagement/relocation/version")) {
+ relocationRevision = txt;
return;
}
if (context.startsWith("project/parent")) {
Modified:
incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=597090&r1=597089&r2=597090&view=diff
==============================================================================
---
incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
(original)
+++
incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
Wed Nov 21 06:00:41 2007
@@ -2938,8 +2938,7 @@
"test", "jar", "jar").exists());
}
-
- public void testResolveMaven2Relocation() throws Exception {
+ public void testResolveMaven2RelocationOfGroupId() throws Exception {
//Same as testResolveMaven2 but with a relocated module pointing to
the module
//used in testResolveMaven2.
ivy = new Ivy();
@@ -2948,6 +2947,34 @@
try {
ResolveReport report = ivy.resolve(new File(
"test/repositories/m2/org/relocated/test3/1.0/test3-1.0.pom").toURL(),
+ getResolveOptions(new String[] {"*"}));
+ assertNotNull(report);
+
+ // dependencies
+ assertTrue(ivy.getCacheManager(cache).getIvyFileInCache(
+ ModuleRevisionId.newInstance("org.apache", "test2",
"1.0")).exists());
+ assertTrue(TestHelper.getArchiveFileInCache(ivy, cache,
"org.apache", "test2", "1.0",
+ "test2", "jar", "jar").exists());
+
+ assertTrue(ivy.getCacheManager(cache).getIvyFileInCache(
+ ModuleRevisionId.newInstance("org.apache", "test",
"1.0")).exists());
+ assertTrue(TestHelper.getArchiveFileInCache(ivy, cache,
"org.apache", "test", "1.0",
+ "test", "jar", "jar").exists());
+ } finally {
+ ivy.popContext();
+ }
+ }
+
+
+ public void testResolveMaven2FullRelocation() throws Exception {
+ //Same as testResolveMaven2 but with a relocated module pointing to
the module
+ //used in testResolveMaven2.
+ ivy = new Ivy();
+ ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
+ ivy.pushContext();
+ try {
+ ResolveReport report = ivy.resolve(new File(
+
"test/repositories/m2/org/relocated/test3full/1.1/test3full-1.1.pom").toURL(),
getResolveOptions(new String[] {"*"}));
assertNotNull(report);
Added:
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3full/1.1/test3full-1.1.pom
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3full/1.1/test3full-1.1.pom?rev=597090&view=auto
==============================================================================
---
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3full/1.1/test3full-1.1.pom
(added)
+++
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3full/1.1/test3full-1.1.pom
Wed Nov 21 06:00:41 2007
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.relocated</groupId>
+ <artifactId>test3full</artifactId>
+ <name>Test Module for Ivy M2 relocation parsing</name>
+ <version>1.1</version>
+ <distributionManagement>
+ <relocation>
+ <groupId>org.apache</groupId>
+ <artifactId>test3</artifactId>
+ <version>1.0</version>
+ </relocation>
+ </distributionManagement>
+</project>
Propchange:
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3full/1.1/test3full-1.1.pom
------------------------------------------------------------------------------
svn:executable = *