Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 64065 invoked from network); 29 Mar 2007 13:43:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Mar 2007 13:43:29 -0000 Received: (qmail 6404 invoked by uid 500); 29 Mar 2007 13:43:36 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 6273 invoked by uid 500); 29 Mar 2007 13:43:35 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 6262 invoked by uid 99); 29 Mar 2007 13:43:35 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Mar 2007 06:43:35 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Mar 2007 06:43:27 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id A16181A9838; Thu, 29 Mar 2007 06:43:07 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r523706 - in /cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src: main/java/org/apache/cocoon/maven/rcl/ test/java/org/apache/cocoon/maven/rcl/ Date: Thu, 29 Mar 2007 13:43:07 -0000 To: cvs@cocoon.apache.org From: reinhard@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070329134307.A16181A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: reinhard Date: Thu Mar 29 06:43:06 2007 New Revision: 523706 URL: http://svn.apache.org/viewvc?view=rev&rev=523706 Log: - make sure that all generated paths are correct when the plugin is executed as part of an aggregated build - use toUri().toAscii() instead of toUrl().toExternalForm() as suggested by Jorg in a separate thread Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/RwmProperties.java cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/test/java/org/apache/cocoon/maven/rcl/RwmPropertiesTest.java Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java?view=diff&rev=523706&r1=523705&r2=523706 ============================================================================== --- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java (original) +++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java Thu Mar 29 06:43:06 2007 @@ -91,9 +91,9 @@ /** * The directory that contains the Cocoon web application. * - * @parameter expression="${cocoon.rcl.properties}" + * @parameter expression="./rcl.properties" */ - private File rclPropertiesFile = new File("./rcl.properties"); + private File rclPropertiesFile; /** * Use socket appender @@ -211,7 +211,7 @@ protected RwmProperties readProperties() throws MojoExecutionException { RwmProperties props = null; try { - props = new RwmProperties(this.rclPropertiesFile); + props = new RwmProperties(this.rclPropertiesFile, this.project.getBasedir()); } catch (ConfigurationException e) { throw new MojoExecutionException("Can't read " + this.rclPropertiesFile.getAbsolutePath(), e); } Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/RwmProperties.java URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/RwmProperties.java?view=diff&rev=523706&r1=523705&r2=523706 ============================================================================== --- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/RwmProperties.java (original) +++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/main/java/org/apache/cocoon/maven/rcl/RwmProperties.java Thu Mar 29 06:43:06 2007 @@ -37,9 +37,11 @@ private static final String TARGET_CLASSES_DIR = "target/classes"; private Configuration props; - - public RwmProperties(File propsFile) throws ConfigurationException { - props = new PropertiesConfiguration(propsFile); + private File basedir; + + public RwmProperties(File propsFile, File basedir) throws ConfigurationException { + this.props = new PropertiesConfiguration(propsFile); + this.basedir = basedir; } public Set getClassesDirs() throws MojoExecutionException { @@ -52,7 +54,7 @@ String path = values[i]; String url = null; try { - url = new File(path).toURL().toExternalForm(); + url = getUrlAsString(path); } catch (MalformedURLException e) { throw new MojoExecutionException("Can't create URL to " + path, e); } @@ -86,7 +88,7 @@ if(key.endsWith(BLOCK_CONTEXT_URL_PARAM)) { String path = null; try { - path = new File(this.props.getString(key)).toURL().toExternalForm(); + path = this.getUrlAsString(this.props.getString(key)); } catch (MalformedURLException e) { throw new MojoExecutionException("Can't create URL to " + path, e); } @@ -97,7 +99,7 @@ else if(key.endsWith(CLASSES_DIR) && !CLASSES_DIR.equals(key)) { String path = null; try { - path = new File(this.props.getString(key)).toURL().toExternalForm(); + path = this.getUrlAsString(this.props.getString(key)); } catch (MalformedURLException e) { throw new MojoExecutionException("Can't create URL to " + this.props.getString(key), e); } @@ -141,6 +143,21 @@ } } return cocoonProps; + } + + private String getUrlAsString(String path) throws MalformedURLException { + // find out if the path is relative or absolute + boolean absolute = false; + if(path.indexOf(':') == 1 || path.startsWith("/")) { + absolute = true; + } + File p = null; + if(absolute) { + p = new File(path); + } else { + p = new File(this.basedir, path); + } + return p.toURI().toASCIIString(); } } Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/test/java/org/apache/cocoon/maven/rcl/RwmPropertiesTest.java URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/test/java/org/apache/cocoon/maven/rcl/RwmPropertiesTest.java?view=diff&rev=523706&r1=523705&r2=523706 ============================================================================== --- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/test/java/org/apache/cocoon/maven/rcl/RwmPropertiesTest.java (original) +++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-plugin/src/test/java/org/apache/cocoon/maven/rcl/RwmPropertiesTest.java Thu Mar 29 06:43:06 2007 @@ -80,7 +80,7 @@ } protected RwmProperties createTestProperties() throws Exception { - return new RwmProperties(getResourcesFromClassLoaderAsFile("rcl.properties")); + return new RwmProperties(getResourcesFromClassLoaderAsFile("rcl.properties"), new File("")); } protected File getResourcesFromClassLoaderAsFile(String fileName) throws IOException {