ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r690317 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/cache/ src/java/org/apache/ivy/core/deliver/ src/java/org/apache/ivy/core/publish/ src/java/org/apache/ivy/core/retrieve/ src/java/org/apache/ivy...
Date Fri, 29 Aug 2008 16:24:06 GMT
Author: xavier
Date: Fri Aug 29 09:24:03 2008
New Revision: 690317

URL: http://svn.apache.org/viewvc?rev=690317&view=rev
Log:
FIX: Incorrect directory path resolve when running from a different directory (IVY-232)

Added:
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileResolver.java   (with props)
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-packager.xml   (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileRepository.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileResource.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/Configurator.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/trigger/LogTriggerTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Aug 29 09:24:03 2008
@@ -108,6 +108,7 @@
 - IMPROVEMENT: Add a memory cache for the module descriptor that are parsed from the cache (IVY-883)
 - IMPROVEMENT: Improve performance (IVY-872)
 
+- FIX: Incorrect directory path resolve when running from a different directory (IVY-232)
 - FIX: Ivy#listTokenValues(String, Map) does not filter returned values, and does not use maven-metadata.xml files with IBiblio resolver (IVY-886)
 - FIX: Circular Dependency messages in a resolve do not reflect the configuration used during the resolve (IVY-708)
 - FIX: Failure to transitively install Maven2 artifacts with namespace (IVY-440)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java Fri Aug 29 09:24:03 2008
@@ -122,8 +122,8 @@
     }
 
     private File getBuildFile(IvyEvent event) {
-        return new File(IvyPatternHelper.substituteTokens(getBuildFilePattern(), event
-                .getAttributes()));
+        return IvyContext.getContext().getSettings().resolveFile(
+            IvyPatternHelper.substituteTokens(getBuildFilePattern(), event.getAttributes()));
     }
 
     public String getBuildFilePattern() {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java Fri Aug 29 09:24:03 2008
@@ -243,6 +243,7 @@
         IvyAntVariableContainer ivyAntVariableContainer = new IvyAntVariableContainer(getProject());
 
         IvySettings settings = new IvySettings(ivyAntVariableContainer);
+        settings.setBaseDir(getProject().getBaseDir());
         
         if (file == null && url == null) {
             defineDefaultSettingFile(ivyAntVariableContainer);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java Fri Aug 29 09:24:03 2008
@@ -96,7 +96,7 @@
         if (file == null) {
             String fileName = getProperty(settings, "ivy.resolved.file", resolveId);
             if (fileName != null) {
-                file = new File(fileName);
+                file = getProject().resolveFile(fileName);
             }
         }
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java Fri Aug 29 09:24:03 2008
@@ -274,8 +274,8 @@
         }
         ModuleRevisionId mrid = ModuleRevisionId.newInstance(organisation, module, revision);
         try {
-            File ivyFile = new File(IvyPatternHelper.substitute(srcivypattern, organisation,
-                module, pubRevision, "ivy", "ivy", "xml"));
+            File ivyFile = getProject().resolveFile(IvyPatternHelper.substitute(
+                    srcivypattern, organisation, module, pubRevision, "ivy", "ivy", "xml"));
             if (publishivy && (!ivyFile.exists() || forcedeliver)) {
                 IvyDeliver deliver = new IvyDeliver();
                 deliver.setSettingsRef(getSettingsRef());

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java Fri Aug 29 09:24:03 2008
@@ -170,7 +170,7 @@
         if (todir == null) {
             String t = getProperty(settings, "ivy.report.todir");
             if (t != null) {
-                todir = new File(t);
+                todir = getProject().resolveFile(t);
             }
         }
         if (todir != null && todir.exists()) {
@@ -236,7 +236,7 @@
             if (todir != null) {
                 out = new File(todir, getOutputPattern(confs[i], "xml"));
             } else {
-                out = new File(getOutputPattern(confs[i], "xml"));
+                out = getProject().resolveFile(getOutputPattern(confs[i], "xml"));
             }
 
             FileUtil.copy(xml, out, null);
@@ -253,7 +253,7 @@
             if (todir != null) {
                 css = new File(todir, "ivy-report.css");
             } else {
-                css = new File("ivy-report.css");
+                css = getProject().resolveFile("ivy-report.css");
             }
             
             if (!css.exists()) {
@@ -308,7 +308,7 @@
         if (todir != null) {
             out = todir;
         } else {
-            out = new File(".");
+            out = getProject().getBaseDir();
         }
         
         InputStream xsltStream = null;

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java Fri Aug 29 09:24:03 2008
@@ -55,7 +55,7 @@
 
     private String matcher = PatternMatcher.EXACT_OR_REGEXP;
 
-    private File todir = new File(".");
+    private File todir;
 
     private boolean graph = false;
 
@@ -128,7 +128,7 @@
             if (xml) {
 
                 FileUtil.copy(cacheMgr.getConfigurationResolveReportInCache(resolveId, "default"),
-                    new File(todir, outputname + ".xml"), null);
+                    new File(getTodir(), outputname + ".xml"), null);
             }
             if (xsl) {
                 genreport(cacheMgr, md.getModuleRevisionId().getOrganisation(), md
@@ -149,7 +149,7 @@
 
         String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
         xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
-        xslt.setOut(new File(todir, outputname + "." + xslext));
+        xslt.setOut(new File(getTodir(), outputname + "." + xslext));
 
         xslt.setStyle(xslFile);
 
@@ -206,13 +206,16 @@
 
         String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
         xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
-        xslt.setOut(new File(todir, outputname + "." + ext));
+        xslt.setOut(new File(getTodir(), outputname + "." + ext));
         xslt.setBasedir(cache.getResolutionCacheRoot());
         xslt.setStyle(style);
         xslt.execute();
     }
 
     public File getTodir() {
+        if (todir == null && getProject() != null) {
+            return getProject().getBaseDir();
+        }
         return todir;
     }
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java Fri Aug 29 09:24:03 2008
@@ -343,7 +343,7 @@
         File archive = new File(getRepositoryCacheRoot(), getArchivePathInCache(artifact, origin));
         if (!archive.exists() 
                 && !ArtifactOrigin.isUnknown(origin) && origin.isLocal()) {
-            File original = new File(origin.getLocation());
+            File original = settings.resolveFile(origin.getLocation());
             if (original.exists()) {
                 return original;
             }
@@ -360,7 +360,7 @@
     private File getArchiveFileInCache(
             Artifact artifact, ArtifactOrigin origin, boolean useOrigin) {
         if (useOrigin && !ArtifactOrigin.isUnknown(origin) && origin.isLocal()) {
-            return new File(origin.getLocation());
+            return settings.resolveFile(origin.getLocation());
         } else {
             return new File(getRepositoryCacheRoot(), getArchivePathInCache(artifact, origin));
         }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java Fri Aug 29 09:24:03 2008
@@ -17,6 +17,7 @@
  */
 package org.apache.ivy.core.cache;
 
+import java.io.File;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -117,6 +118,14 @@
         public StatusManager getStatusManager() {
             return delegatedSettings.getStatusManager();
         }
+        
+        public File getBaseDir() {
+            return delegatedSettings.getBaseDir();
+        }
+        
+        public File resolveFile(String filename) {
+            return delegatedSettings.resolveFile(filename);
+        }
 
         public Map substitute(Map strings) {
             Map substituted = new LinkedHashMap();

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java Fri Aug 29 09:24:03 2008
@@ -183,7 +183,7 @@
         confsToRemove.removeAll(Arrays.asList(confs));
 
         try {
-            XmlModuleDescriptorUpdater.update(ivyFileURL, new File(publishedIvy),
+            XmlModuleDescriptorUpdater.update(ivyFileURL, settings.resolveFile(publishedIvy),
                     new UpdateOptions()
                         .setSettings(settings)
                         .setResolvedRevisions(resolvedDependencies)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java Fri Aug 29 09:24:03 2008
@@ -92,7 +92,7 @@
             mrid, options.getPubBranch(), options.getPubrevision());
         File ivyFile;
         if (options.getSrcIvyPattern() != null) {
-            ivyFile = new File(IvyPatternHelper.substitute(options.getSrcIvyPattern(),
+            ivyFile = settings.resolveFile(IvyPatternHelper.substitute(options.getSrcIvyPattern(),
                 DefaultArtifact.newIvyArtifact(pubmrid, new Date())));
             if (!ivyFile.exists()) {
                 throw new IllegalArgumentException("ivy file to publish not found for " + mrid
@@ -201,7 +201,7 @@
             Artifact artifact = (Artifact) iter.next();
             for (Iterator iterator = srcArtifactPattern.iterator(); iterator.hasNext();) {
                 String pattern = (String) iterator.next();
-                File artifactFile = new File(
+                File artifactFile = settings.resolveFile(
                     IvyPatternHelper.substitute(settings.substitute(pattern), artifact));
                 if (artifactFile.exists()) {
                     artifactsFiles.put(artifact, artifactFile);
@@ -213,7 +213,7 @@
                 for (Iterator iterator = srcArtifactPattern.iterator(); iterator.hasNext();) {
                     String pattern = (String) iterator.next();
                     Message.info("\t"
-                            + new File(IvyPatternHelper.substitute(pattern, artifact))
+                            + settings.resolveFile(IvyPatternHelper.substitute(pattern, artifact))
                             + " file does not exist");
                 }
                 if (options.isHaltOnMissing()) {
@@ -224,7 +224,7 @@
         }
         if (options.getSrcIvyPattern() != null) {
             Artifact artifact = MDArtifact.newIvyArtifact(md);
-            File artifactFile = new File(
+            File artifactFile = settings.resolveFile(
                 IvyPatternHelper.substitute(options.getSrcIvyPattern(), artifact));
             if (!artifactFile.exists()) {
                 Message.info("missing ivy file for "

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java Fri Aug 29 09:24:03 2008
@@ -100,9 +100,10 @@
 
         try {
             Map artifactsToCopy = determineArtifactsToCopy(mrid, destFilePattern, options);
-            File fileRetrieveRoot = new File(IvyPatternHelper.getTokenRoot(destFilePattern));
-            File ivyRetrieveRoot = destIvyPattern == null ? null : new File(IvyPatternHelper
-                    .getTokenRoot(destIvyPattern));
+            File fileRetrieveRoot = settings.resolveFile(
+                IvyPatternHelper.getTokenRoot(destFilePattern));
+            File ivyRetrieveRoot = destIvyPattern == null 
+                ? null : settings.resolveFile(IvyPatternHelper.getTokenRoot(destIvyPattern));
             Collection targetArtifactsStructure = new HashSet(); // Set(File) set of all paths
             // which should be present at
             // then end of retrieve (useful
@@ -124,7 +125,7 @@
                 Message.verbose("\tretrieving " + archive);
                 for (Iterator it2 = dest.iterator(); it2.hasNext();) {
                     IvyContext.getContext().checkInterrupted();
-                    File destFile = new File((String) it2.next());
+                    File destFile = settings.resolveFile((String) it2.next());
                     if (!settings.isCheckUpToDate() || !upToDate(archive, destFile)) {
                         Message.verbose("\t\tto " + destFile);
                         if (options.isMakeSymlinks()) {
@@ -301,7 +302,7 @@
                     dest = new HashSet();
                     artifactsToCopy.put(artifact, dest);
                 }
-                String copyDest = new File(destFileName).getAbsolutePath();
+                String copyDest = settings.resolveFile(destFileName).getAbsolutePath();
                 dest.add(copyDest);
 
                 Set conflicts = (Set) conflictsMap.get(copyDest);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java Fri Aug 29 09:24:03 2008
@@ -98,6 +98,8 @@
 import org.apache.ivy.plugins.version.SubVersionMatcher;
 import org.apache.ivy.plugins.version.VersionMatcher;
 import org.apache.ivy.plugins.version.VersionRangeMatcher;
+import org.apache.ivy.util.FileResolver;
+import org.apache.ivy.util.FileUtil;
 import org.apache.ivy.util.Message;
 import org.apache.ivy.util.filter.Filter;
 import org.apache.ivy.util.url.URLHandlerRegistry;
@@ -105,7 +107,7 @@
 public class IvySettings implements SortEngineSettings, PublishEngineSettings, ParserSettings,
         DeliverEngineSettings, CheckEngineSettings, InstallEngineSettings, 
         ResolverSettings, ResolveEngineSettings, RetrieveEngineSettings, 
-        RepositoryManagementEngineSettings {
+        RepositoryManagementEngineSettings, FileResolver {
     private static final long INTERUPT_TIMEOUT = 2000;
 
     private Map typeDefs = new HashMap();
@@ -179,6 +181,8 @@
     private boolean useRemoteConfig = false;
 
     private File defaultUserDir;
+    
+    private File baseDir = new File(".");
 
     private List classpathURLs = new ArrayList();
 
@@ -218,7 +222,7 @@
             String[] files = ivyTypeDefs.split("\\,");
             for (int i = 0; i < files.length; i++) {
                 try {
-                    typeDefs(new FileInputStream(new File(files[i].trim())), true);
+                    typeDefs(new FileInputStream(resolveFile(files[i].trim())), true);
                 } catch (FileNotFoundException e) {
                     Message.warn("typedefs file not found: " + files[i].trim());
                 } catch (IOException e) {
@@ -360,7 +364,7 @@
         long start = System.currentTimeMillis();
         setSettingsVariables(settingsFile);
         if (getVariable("ivy.default.ivy.user.dir") != null) {
-            setDefaultIvyUserDir(new File(getVariable("ivy.default.ivy.user.dir")));
+            setDefaultIvyUserDir(resolveFile(getVariable("ivy.default.ivy.user.dir")));
         } else {
             getDefaultIvyUserDir();
         }
@@ -385,7 +389,7 @@
         long start = System.currentTimeMillis();
         setSettingsVariables(settingsURL);
         if (getVariable("ivy.default.ivy.user.dir") != null) {
-            setDefaultIvyUserDir(new File(getVariable("ivy.default.ivy.user.dir")));
+            setDefaultIvyUserDir(resolveFile(getVariable("ivy.default.ivy.user.dir")));
         } else {
             getDefaultIvyUserDir();
         }
@@ -407,7 +411,7 @@
      */
     public void defaultInit() throws IOException {
         if (getVariable("ivy.default.ivy.user.dir") != null) {
-            setDefaultIvyUserDir(new File(getVariable("ivy.default.ivy.user.dir")));
+            setDefaultIvyUserDir(resolveFile(getVariable("ivy.default.ivy.user.dir")));
         } else {
             getDefaultIvyUserDir();
         }
@@ -729,11 +733,35 @@
             new MapMatcher(attributes, matcher), 
             new ModuleSettings(resolverName, branch, conflictManager, resolveMode));
     }
+    
+    /**
+     * Return the canonical form of a filename.
+     * <p>
+     * If the specified file name is relative it is resolved
+     * with respect to the settings's base directory.
+     *
+     * @param fileName The name of the file to resolve.
+     *                 Must not be <code>null</code>.
+     *
+     * @return the resolved File.
+     *
+     */
+    public File resolveFile(String fileName) {
+        return FileUtil.resolveFile(baseDir, fileName);
+    }
+    
+    public void setBaseDir(File baseDir) {
+        this.baseDir = baseDir;
+    }
+    
+    public File getBaseDir() {
+        return baseDir;
+    }
 
     public File getDefaultIvyUserDir() {
         if (defaultUserDir == null) {
             if (getVariable("ivy.home") != null) {
-                setDefaultIvyUserDir(new File(getVariable("ivy.home")));
+                setDefaultIvyUserDir(resolveFile(getVariable("ivy.home")));
                 Message.verbose("using ivy.default.ivy.user.dir variable for default ivy user dir: "
                                 + defaultUserDir);
             } else {
@@ -754,7 +782,7 @@
         if (defaultCache == null) {
             String cache = getVariable("ivy.cache.dir");
             if (cache != null) {
-                defaultCache = new File(cache);
+                defaultCache = resolveFile(cache);
             } else {
                 setDefaultCache(new File(getDefaultIvyUserDir(), "cache"));
                 Message.verbose("no default cache defined: set to " + defaultCache);
@@ -785,7 +813,7 @@
     public File getDefaultRepositoryCacheBasedir() {
         String repositoryCacheRoot = getVariable("ivy.cache.repository");
         if (repositoryCacheRoot != null) {
-            return new File(repositoryCacheRoot);
+            return resolveFile(repositoryCacheRoot);
         } else {
             return getDefaultCache();
         }
@@ -794,7 +822,7 @@
     public File getDefaultResolutionCacheBasedir() {
         String resolutionCacheRoot = getVariable("ivy.cache.resolution");
         if (resolutionCacheRoot != null) {
-            return new File(resolutionCacheRoot);
+            return resolveFile(resolutionCacheRoot);
         } else {
             return getDefaultCache();
         }
@@ -1415,4 +1443,6 @@
             }
         }
     }
+
+    
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java Fri Aug 29 09:24:03 2008
@@ -130,6 +130,7 @@
 
     public void parse(URL settings) throws ParseException, IOException {
         configurator = new Configurator();
+        configurator.setFileResolver(ivy);
         // put every type definition from ivy to configurator
         Map typeDefs = ivy.getTypeDefs();
         for (Iterator iter = typeDefs.keySet().iterator(); iter.hasNext();) {
@@ -275,7 +276,7 @@
         
         String cache = (String) attributes.get("defaultCacheDir");
         if (cache != null) {
-            ivy.setDefaultCache(new File(cache));
+            ivy.setDefaultCache(resolveFile(cache));
         }
         String up2d = (String) attributes.get("checkUpToDate");
         if (up2d != null) {
@@ -312,7 +313,7 @@
         if (cache != null) {
             Message.deprecated("'defaultCache' is deprecated, "
                 + "use 'caches[@defaultCacheDir]' instead (" + settings + ")");
-            ivy.setDefaultCache(new File(cache));
+            ivy.setDefaultCache(resolveFile(cache));
         }
         String defaultBranch = (String) attributes.get("defaultBranch");
         if (defaultBranch != null) {
@@ -384,7 +385,7 @@
             } else {
                 settingsURL = urlFromFileAttribute(propFilePath);
                 Message.verbose("including file: " + settingsURL);
-                ivy.setSettingsVariables(new File(propFilePath));
+                ivy.setSettingsVariables(resolveFile(propFilePath));
                 //We can not use the setSettingsVariables(URL) because that would put different
                 //values for the properties.  I'm not sure what would be the regression...
             }
@@ -469,7 +470,7 @@
                 throw new IllegalArgumentException(
                         "either url or file should be given for classpath element");
             } else {
-                url = new File(file).toURI().toURL();
+                url = resolveFile(file).toURI().toURL();
             }
         } else {
             url = new URL(urlStr);
@@ -592,4 +593,8 @@
             ivy.setDefaultLockStrategy(strategy);
         }
     }
+
+    private File resolveFile(String filePath) {
+        return ivy.resolveFile(filePath);
+    }
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java Fri Aug 29 09:24:03 2008
@@ -17,6 +17,7 @@
  */
 package org.apache.ivy.plugins.parser;
 
+import java.io.File;
 import java.util.Map;
 
 import org.apache.ivy.core.RelativeUrlResolver;
@@ -47,5 +48,9 @@
     RelativeUrlResolver getRelativeUrlResolver();
     
     DependencyResolver getResolver(ModuleRevisionId mRevId);
+    
+    File resolveFile(String filename);
+    
+    File getBaseDir();
 
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java Fri Aug 29 09:24:03 2008
@@ -445,7 +445,7 @@
                         String urlStr = attributes.getValue("url");
                         url = new URL(urlStr);
                     } else {
-                        url = new File(fileName).toURI().toURL();
+                        url = settings.resolveFile(fileName).toURI().toURL();
                     }
                 }
                 XMLHelper.parse(url, null, new DefaultHandler() {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileRepository.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileRepository.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileRepository.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileRepository.java Fri Aug 29 09:24:03 2008
@@ -110,9 +110,9 @@
         return null;
     }
 
-    private File getFile(String source) {
+    File getFile(String source) {
         if (baseDir != null) {
-            return new File(baseDir, source);
+            return FileUtil.resolveFile(baseDir, source);
         } else {
             return new File(source);
         }
@@ -126,4 +126,11 @@
         this.local = local;
     }
 
+    public File getBaseDir() {
+        return baseDir;
+    }
+    
+    public void setBaseDir(File baseDir) {
+        this.baseDir = baseDir;
+    }
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileResource.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileResource.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileResource.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileResource.java Fri Aug 29 09:24:03 2008
@@ -39,7 +39,7 @@
     }
 
     public Resource clone(String cloneName) {
-        return new FileResource(repository, new File(cloneName));
+        return new FileResource(repository, repository.getFile(cloneName));
     }
 
     public long getLastModified() {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java Fri Aug 29 09:24:03 2008
@@ -466,7 +466,7 @@
      * remote side.
      * 
      * @param localFile
-     *            Path and name of local file.
+     *            Path and name of local file. Must be absolute.
      * @param remoteTargetDir
      *            Remote target directory where the file has to end up (optional)
      * @param remoteTargetName
@@ -526,7 +526,7 @@
      * @param remoteFile
      *            Path and name of the remote file.
      * @param localTarget
-     *            Local file where to store the data.
+     *            Local file where to store the data. Must be absolute.
      * @throws IOException
      *             in case of network problems
      * @throws RemoteScpException

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java Fri Aug 29 09:24:03 2008
@@ -151,7 +151,8 @@
 
             int index = source.lastIndexOf('/');
             String srcName = index == -1 ? source : source.substring(index + 1);
-            final File to = destDir == null ? new File(srcName) : new File(destDir, srcName);
+            final File to = destDir == null 
+                    ? ivy.getSettings().resolveFile(srcName) : new File(destDir, srcName);
 
             final IOException[] ex = new IOException[1];
             Thread get = new IvyThread() {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java Fri Aug 29 09:24:03 2008
@@ -51,8 +51,8 @@
      * @param filePath
      *            full file path name
      */
-    public void setKeyFile(String filePath) {
-        getSshBasedRepository().setKeyFile(new File(filePath));
+    public void setKeyFile(File filePath) {
+        getSshBasedRepository().setKeyFile(filePath);
     }
 
     /**
@@ -60,8 +60,8 @@
      * load username and passwd entries, and to store them if the user choose to do so. Defaults to
      * user.dir/.ivy/[host].sftp.passwd, set it to null to disable this feature.
      */
-    public void setPassfile(String passfile) {
-        getSshBasedRepository().setPassFile(passfile == null ? null : new File(passfile));
+    public void setPassfile(File passfile) {
+        getSshBasedRepository().setPassFile(passfile);
         passfileSet = true;
     }
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java Fri Aug 29 09:24:03 2008
@@ -77,6 +77,14 @@
     public FileSystemResolver() {
         setRepository(new FileRepository());
     }
+    
+    public void setSettings(ResolverSettings settings) {
+        super.setSettings(settings);
+        FileRepository fileRepository = getFileRepository();
+        if (fileRepository.getBaseDir() == null) {
+            fileRepository.setBaseDir(settings.getBaseDir());
+        }
+    }
 
     public String getTypeName() {
         return "file";
@@ -276,11 +284,11 @@
     }
 
     private void initTransaction(ModuleRevisionId module) {
-        transactionTempDir = new File(IvyPatternHelper.substitute(
+        transactionTempDir = getSettings().resolveFile(IvyPatternHelper.substitute(
             baseTransactionPattern, 
             ModuleRevisionId.newInstance(
                 module, module.getRevision() + TRANSACTION_DESTINATION_SUFFIX)));
-        transactionDestDir = new File(IvyPatternHelper.substitute(
+        transactionDestDir = getSettings().resolveFile(IvyPatternHelper.substitute(
             baseTransactionPattern, 
             module));
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerResolver.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerResolver.java Fri Aug 29 09:24:03 2008
@@ -85,15 +85,29 @@
     /**
      * Set root directory under which builds take place.
      */
-    public void setBuildRoot(String buildRoot) {
-        this.buildRoot = new File(buildRoot);
+    public void setBuildRoot(File buildRoot) {
+        this.buildRoot = buildRoot;
+    }
+    
+    /**
+     * Returns root directory under which builds take place. 
+     */
+    public File getBuildRoot() {
+        return buildRoot;
     }
 
     /**
      * Set resource cache directory.
      */
-    public void setResourceCache(String resourceCache) {
-        this.resourceCache = resourceCache != null ? new File(resourceCache) : null;
+    public void setResourceCache(File resourceCache) {
+        this.resourceCache = resourceCache;
+    }
+    
+    /**
+     * Get resource cache directory.
+     */
+    public File getResourceCache() {
+        return resourceCache;
     }
 
     /**

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java Fri Aug 29 09:24:03 2008
@@ -100,17 +100,15 @@
 
     /**
      * File to write to.
-     * @param file the file to write to, if not set, echo to
-     *             standard Ivy logging
+     * @param file the file to write to, if not set, echo to standard Ivy logging
      */
-    public void setFile(String file) {
-        this.file = new File(file);
+    public void setFile(File file) {
+        this.file = file;
     }
 
     /**
      * If true, append to existing file.
-     * @param append if true, append to existing file, default
-     *               is false.
+     * @param append if true, append to existing file, default is false.
      */
     public void setAppend(boolean append) {
         this.append = append;

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/Configurator.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/Configurator.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/Configurator.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/Configurator.java Fri Aug 29 09:24:03 2008
@@ -17,6 +17,7 @@
  */
 package org.apache.ivy.util;
 
+import java.io.File;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -429,6 +430,8 @@
             return objName;
         }
     }
+    
+    private FileResolver fileResolver = FileResolver.DEFAULT;
 
     private Map typedefs = new HashMap();
 
@@ -637,6 +640,8 @@
                 convertedValue = Long.valueOf(value);
             } else if (paramClass.equals(Class.class)) {
                 convertedValue = Class.forName(value);
+            } else if (paramClass.equals(File.class)) {
+                convertedValue = fileResolver.resolveFile(value);
             } else {
                 convertedValue = paramClass.getConstructor(new Class[] {String.class}).newInstance(
                     new Object[] {value});
@@ -746,4 +751,13 @@
     public Class getTypeDef(String name) {
         return (Class) typedefs.get(name);
     }
+    
+    public FileResolver getFileResolver() {
+        return fileResolver;
+    }
+    
+    public void setFileResolver(FileResolver fileResolver) {
+        Checks.checkNotNull(fileResolver, "fileResolver");
+        this.fileResolver = fileResolver;
+    }
 }

Added: ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileResolver.java?rev=690317&view=auto
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileResolver.java (added)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileResolver.java Fri Aug 29 09:24:03 2008
@@ -0,0 +1,42 @@
+/*
+ *  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.
+ *
+ */
+package org.apache.ivy.util;
+
+import java.io.File;
+
+public interface FileResolver {
+    public static final FileResolver DEFAULT = new FileResolver() {
+        public File resolveFile(String filename) {
+            return new File(filename);
+        }
+    };
+    
+    /**
+     * Return the canonical form of a filename.
+     * <p>
+     * If the specified file name is relative it is resolved
+     * with respect to the settings's base directory.
+     *
+     * @param fileName The name of the file to resolve.
+     *                 Must not be <code>null</code>.
+     *
+     * @return the resolved File.
+     *
+     */
+    File resolveFile(String filename);
+}

Propchange: ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileResolver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java Fri Aug 29 09:24:03 2008
@@ -352,4 +352,16 @@
         return list;
     }
 
+    public static File resolveFile(File file, String filename) {
+        /*
+         * very simple resolveFile algorithm compared to what is done in Ant. It must be enough in
+         * most common cases though.
+         */
+        File f = new File(filename);
+        if (f.isAbsolute()) {
+            return f;
+        }
+        return new File(file, filename);
+    }
+
 }

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsTest.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsTest.java Fri Aug 29 09:24:03 2008
@@ -97,7 +97,7 @@
         IvySettings settings = ivy.getSettings();
         assertNotNull(settings);
 
-        assertEquals(new File("build/cache"), settings.getDefaultCache());
+        assertEquals(new File("build/cache").getAbsoluteFile(), settings.getDefaultCache());
         assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings
                 .getVariables().getVariable("ivy.settings.file"));
         assertEquals(new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm(),
@@ -119,7 +119,7 @@
 
         IvySettings settings = getIvyInstance().getSettings();
 
-        assertEquals(new File("build/cache"), settings.getDefaultCache());
+        assertEquals(new File("build/cache").getAbsoluteFile(), settings.getDefaultCache());
         assertEquals(confUrl, settings.getVariables().getVariable("ivy.settings.url"));
         assertEquals(confDirUrl, settings.getVariables().getVariable("ivy.settings.dir"));
         assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java Fri Aug 29 09:24:03 2008
@@ -100,7 +100,7 @@
         IvySettings settings = ivy.getSettings();
         assertNotNull(settings);
 
-        assertEquals(new File("build/cache"), settings.getDefaultCache());
+        assertEquals(new File("build/cache").getAbsoluteFile(), settings.getDefaultCache());
         assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings
                 .getVariables().getVariable("ivy.settings.file"));
         assertEquals(new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm(),
@@ -123,7 +123,7 @@
 
         IvySettings settings = getIvyInstance().getSettings();
 
-        assertEquals(new File("build/cache"), settings.getDefaultCache());
+        assertEquals(new File("build/cache").getAbsoluteFile(), settings.getDefaultCache());
         assertEquals(confUrl, settings.getVariables().getVariable("ivy.settings.url"));
         assertEquals(confDirUrl, settings.getVariables().getVariable("ivy.settings.dir"));
         assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java Fri Aug 29 09:24:03 2008
@@ -45,7 +45,7 @@
         IvySettings settings = ivy.getSettings();
         assertNotNull(settings);
 
-        assertEquals(new File("build/cache"), settings.getDefaultCache());
+        assertEquals(new File("test/repositories/build/cache").getAbsoluteFile(), settings.getDefaultCache());
         // The next test doesn't always works on windows (mix C: and c: drive)
         assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath().toUpperCase(),
             new File((String) settings.getVariables().getVariable("ivy.settings.file")).getAbsolutePath()
@@ -79,7 +79,7 @@
         IvySettings settings = ivy.getSettings();
         assertNotNull(settings);
 
-        assertEquals(new File("build/cache"), settings.getDefaultCache());
+        assertEquals(new File("build/cache").getAbsoluteFile(), settings.getDefaultCache());
         assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings
                 .getVariables().getVariable("ivy.settings.file"));
         assertEquals(new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm(),

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Fri Aug 29 09:24:03 2008
@@ -761,13 +761,13 @@
         // ivy file should be cached in default cache, and artifact in cache2
         assertTrue(cacheMgr1.getIvyFileInCache(depMrid).exists());
         assertFalse(cacheMgr1.getArchiveFileInCache(depArtifact).exists());
-        assertEquals(new File(cache, "repo1/mod1.1/ivy-1.0.xml"), 
-            cacheMgr1.getIvyFileInCache(depMrid));
+        assertEquals(new File(cache, "repo1/mod1.1/ivy-1.0.xml").getCanonicalFile(), 
+            cacheMgr1.getIvyFileInCache(depMrid).getCanonicalFile());
         
         assertFalse(cacheMgr2.getIvyFileInCache(depMrid).exists());
         assertTrue(cacheMgr2.getArchiveFileInCache(depArtifact).exists());
-        assertEquals(new File(cache, "repo2/mod1.1-1.0/mod1.1.jar"), 
-            cacheMgr2.getArchiveFileInCache(depArtifact));
+        assertEquals(new File(cache, "repo2/mod1.1-1.0/mod1.1.jar").getCanonicalFile(), 
+            cacheMgr2.getArchiveFileInCache(depArtifact).getCanonicalFile());
     }
 
     public void testForceLocal() throws Exception {

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java Fri Aug 29 09:24:03 2008
@@ -43,6 +43,7 @@
 import org.apache.ivy.plugins.resolver.FileSystemResolver;
 import org.apache.ivy.plugins.resolver.IBiblioResolver;
 import org.apache.ivy.plugins.resolver.MockResolver;
+import org.apache.ivy.plugins.resolver.packager.PackagerResolver;
 import org.apache.ivy.plugins.version.ChainVersionMatcher;
 import org.apache.ivy.plugins.version.MockVersionMatcher;
 import org.apache.ivy.plugins.version.VersionMatcher;
@@ -189,8 +190,10 @@
         XmlSettingsParser parser = new XmlSettingsParser(settings);
         parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-cache.xml"));
 
-        assertEquals(new File("repository"), settings.getDefaultRepositoryCacheBasedir());
-        assertEquals(new File("resolution"), settings.getDefaultResolutionCacheBasedir());
+        assertEquals(new File("repository").getCanonicalFile(), 
+                    settings.getDefaultRepositoryCacheBasedir().getCanonicalFile());
+        assertEquals(new File("resolution").getCanonicalFile(), 
+                    settings.getDefaultResolutionCacheBasedir().getCanonicalFile());
         assertEquals("artifact-lock", settings.getDefaultLockStrategy().getName());
 
         assertEquals("[module]/ivys/ivy-[revision].xml", settings.getDefaultCacheIvyPattern());
@@ -209,7 +212,7 @@
             c.getTTL(ModuleRevisionId.newInstance("org2", "A", "A")));
         assertEquals(60 * 3600 * 1000, // 2d 12h = 60h 
             c.getTTL(ModuleRevisionId.newInstance("org3", "A", "A")));
-        assertEquals(new File("mycache"), c.getBasedir());
+        assertEquals(new File("mycache").getCanonicalFile(), c.getBasedir().getCanonicalFile());
         assertEquals(false, c.isUseOrigin());
         assertEquals("no-lock", c.getLockStrategy().getName());
 
@@ -219,7 +222,7 @@
         DefaultRepositoryCacheManager c2 = (DefaultRepositoryCacheManager) settings.getRepositoryCacheManager("mycache2");
         assertNotNull(c2);
         assertEquals("mycache2", c2.getName());
-        assertEquals(new File("repository"), c2.getBasedir());
+        assertEquals(new File("repository").getCanonicalFile(), c2.getBasedir().getCanonicalFile());
         assertEquals("artifact-lock", c2.getLockStrategy().getName());
 
         assertEquals("[module]/ivys/ivy-[revision].xml", c2.getIvyPattern());
@@ -555,6 +558,21 @@
         assertTrue(lockStrategy instanceof MyLockStrategy);
     }
 
+    public void testFileAttribute() throws Exception {
+        IvySettings settings = new IvySettings();
+        File basedir = new File("test").getAbsoluteFile();
+        settings.setBaseDir(basedir);
+        XmlSettingsParser parser = new XmlSettingsParser(settings);
+        parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-packager.xml"));
+
+        DependencyResolver r = settings.getResolver("packager");
+        assertNotNull(r);
+        assertTrue(r instanceof PackagerResolver);
+        PackagerResolver packager = (PackagerResolver) r;
+        assertEquals(new File(basedir, "packager/build"), packager.getBuildRoot());
+        assertEquals(new File(basedir, "packager/cache"), packager.getResourceCache());
+    }
+
     public static class MyOutputter implements ReportOutputter {
         public void output(
                 ResolveReport report, ResolutionCacheManager cacheMgr, ResolveOptions options) {

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-packager.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-packager.xml?rev=690317&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-packager.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-packager.xml Fri Aug 29 09:24:03 2008
@@ -0,0 +1,29 @@
+<!--
+   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.    
+-->
+<ivysettings>
+	<resolvers>
+		<packager name="packager"
+		         buildRoot="packager/build"
+		         resourceCache="packager/cache"
+		         resourceURL="ftp://mirror.example.com/pub/resources/[organisation]/[module]/">
+		    <ivy pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/ivy.xml"/>
+		    <artifact pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/packager.xml"/>
+		</packager>
+	</resolvers>
+</ivysettings>

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-packager.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-packager.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java Fri Aug 29 09:24:03 2008
@@ -161,7 +161,7 @@
             new DefaultDependencyDescriptor(mrid, false), data);
         
         // check that the found ivy file is the one from the first pattern!
-        assertEquals("test/repositories/multi-ivypattern/ivy1/ivy-1.0.xml", 
+        assertEquals("./test/repositories/multi-ivypattern/ivy1/ivy-1.0.xml", 
             ivyRef.getResource().getName().replace('\\', '/'));
     }
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/PackagerResolverTest.java Fri Aug 29 09:24:03 2008
@@ -117,8 +117,8 @@
               "" + new File(repoRoot, "[organisation]/[module]/[revision]/ivy.xml").getAbsoluteFile().toURL().toExternalForm());
             resolver.setPackagerPattern(
               "" + new File(repoRoot, "[organisation]/[module]/[revision]/packager.xml").getAbsoluteFile().toURL().toExternalForm());
-            resolver.setBuildRoot(_builddir.getAbsolutePath());
-            resolver.setResourceCache(_cachedir.getAbsolutePath());
+            resolver.setBuildRoot(_builddir);
+            resolver.setResourceCache(_cachedir);
             resolver.setPreserveBuildDirectories(true);
             resolver.setVerbose(true);
             

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/trigger/LogTriggerTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/trigger/LogTriggerTest.java?rev=690317&r1=690316&r2=690317&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/trigger/LogTriggerTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/trigger/LogTriggerTest.java Fri Aug 29 09:24:03 2008
@@ -63,7 +63,7 @@
     public void testFile() throws Exception {
         trigger.setMessage("msg: ${organisation} ${module} ${revision}");
         File f = new File(testDir, "test.log");
-        trigger.setFile(f.getPath());
+        trigger.setFile(f);
         
         trigger.progress(ev);
         
@@ -79,7 +79,7 @@
     public void testFileNoAppend() throws Exception {
         trigger.setMessage("msg: ${organisation} ${module} ${revision}");
         File f = new File(testDir, "test.log");
-        trigger.setFile(f.getPath());
+        trigger.setFile(f);
         trigger.setAppend(false);
         
         trigger.progress(ev);



Mime
View raw message