Author: gscokart
Date: Mon Nov 19 08:03:16 2007
New Revision: 596346
URL: http://svn.apache.org/viewvc?rev=596346&view=rev
Log:
FIX: Ivy doesn't handle relocation in pom.xml (IVY-586). I took the simple
aproach consisting of considering the relocation as the unique dependency.
Added:
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3/
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3/1.0/
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3/1.0/test3-1.0.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=596346&r1=596345&r2=596346&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
Mon Nov 19 08:03:16 2007
@@ -130,6 +130,8 @@
private Stack contextStack = new Stack();
private String organisation;
+
+ private String relocationOrganisation = null;
private String module;
@@ -283,6 +285,14 @@
exclusions.add(new ModuleId(organisation, module));
organisation = null;
module = null;
+ } else if
("project/distributionManagement/relocation".equals(context)) {
+ md.setModuleRevisionId(ModuleRevisionId
+ .newInstance(organisation, module, revision));
+ dd = new DefaultDependencyDescriptor(md,
ModuleRevisionId.newInstance(
+ relocationOrganisation, module, revision), true, false,
true);
+ dd.addDependencyConfiguration("*", "*");
+ md.addDependency(dd);
+ dd = null;
}
if ("project/dependencies/dependency".equals(context)) {
organisation = null;
@@ -320,6 +330,10 @@
ext = txt;
return;
}
+ if
(context.equals("project/distributionManagement/relocation/groupId")) {
+ relocationOrganisation = txt;
+ return;
+ }
if (context.startsWith("project/parent")) {
return;
}
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=596346&r1=596345&r2=596346&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
Mon Nov 19 08:03:16 2007
@@ -2946,6 +2946,35 @@
"test", "jar", "jar").exists());
}
+
+ public void testResolveMaven2Relocation() 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/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 testResolveMaven2Classifiers() throws Exception {
// test case for IVY-418
// test-classifier depends on test-classified with classifier asl
Added:
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3/1.0/test3-1.0.pom
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3/1.0/test3-1.0.pom?rev=596346&view=auto
==============================================================================
---
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3/1.0/test3-1.0.pom
(added)
+++
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3/1.0/test3-1.0.pom
Mon Nov 19 08:03:16 2007
@@ -0,0 +1,31 @@
+<?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>test3</artifactId>
+ <name>Test Module for Ivy M2 relocation parsing</name>
+ <version>1.0</version>
+ <distributionManagement>
+ <relocation>
+ <groupId>org.apache</groupId>
+ </relocation>
+ </distributionManagement>
+</project>
Propchange:
incubator/ivy/core/trunk/test/repositories/m2/org/relocated/test3/1.0/test3-1.0.pom
------------------------------------------------------------------------------
svn:executable = *