Author: bentmann Date: Fri Sep 19 06:48:46 2008 New Revision: 697096 URL: http://svn.apache.org/viewvc?rev=697096&view=rev Log: [MINVOKER-65] Support token "localRepositoryUrl" for filtering settings.xml
Added: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/pom.xml (with props) maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/project/ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/project/pom.xml (with props) maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/settings.xml (with props) maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/pom.xml (with props) maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/project/ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/project/pom.xml (with props) maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/settings.xml (with props) Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/fast-use.apt.vm maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm Added: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/pom.xml?rev=697096&view=auto ============================================================================== --- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/pom.xml (added) +++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/pom.xml Fri Sep 19 06:48:46 2008 @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.invoker</groupId> + <artifactId>local-repo-path</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <description> + Test to check for proper filtering of "localRepository" token. + </description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <build> + <plugins> + <plugin> + <!-- This triggers the download of a known version of this plugin which can then be safely invoked by the IT project --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>2.2</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-invoker-plugin</artifactId> + <version>@pom.version@</version> + <configuration> + <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath> + <pomIncludes> + <pomInclude>*/pom.xml</pomInclude> + </pomIncludes> + <settingsFile>src/it/settings.xml</settingsFile> + <goals> + <goal>org.apache.maven.plugins:maven-resources-plugin:2.2:resources</goal> + </goals> + </configuration> + <executions> + <execution> + <id>integration-test</id> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/pom.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/project/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/project/pom.xml?rev=697096&view=auto ============================================================================== --- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/project/pom.xml (added) +++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/project/pom.xml Fri Sep 19 06:48:46 2008 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>test</artifactId> + <version>0.1-SNAPSHOT</version> + <packaging>jar</packaging> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/project/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/project/pom.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/settings.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/settings.xml?rev=697096&view=auto ============================================================================== --- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/settings.xml (added) +++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/settings.xml Fri Sep 19 06:48:46 2008 @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> + +<settings> + <mirrors> + <mirror> + <id>sandbox</id> + <name>A completely isolated repo to test the interpolation of "localRepository"</name> + <url>file://@localRepository@</url> + <mirrorOf>*</mirrorOf> + </mirror> + </mirrors> +</settings> Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/settings.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-path/src/it/settings.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/pom.xml?rev=697096&view=auto ============================================================================== --- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/pom.xml (added) +++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/pom.xml Fri Sep 19 06:48:46 2008 @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.invoker</groupId> + <artifactId>local-repo-url</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <description> + Test to check for proper filtering of "localRepositoryUrl" token. + </description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <build> + <plugins> + <plugin> + <!-- This triggers the download of a known version of this plugin which can then be safely invoked by the IT project --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>2.2</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-invoker-plugin</artifactId> + <version>@pom.version@</version> + <configuration> + <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath> + <pomIncludes> + <pomInclude>*/pom.xml</pomInclude> + </pomIncludes> + <settingsFile>src/it/settings.xml</settingsFile> + <goals> + <goal>org.apache.maven.plugins:maven-resources-plugin:2.2:resources</goal> + </goals> + </configuration> + <executions> + <execution> + <id>integration-test</id> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/pom.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/project/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/project/pom.xml?rev=697096&view=auto ============================================================================== --- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/project/pom.xml (added) +++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/project/pom.xml Fri Sep 19 06:48:46 2008 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>test</artifactId> + <version>0.1-SNAPSHOT</version> + <packaging>jar</packaging> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/project/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/project/pom.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/settings.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/settings.xml?rev=697096&view=auto ============================================================================== --- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/settings.xml (added) +++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/settings.xml Fri Sep 19 06:48:46 2008 @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> + +<settings> + <mirrors> + <mirror> + <id>sandbox</id> + <name>A completely isolated repo to test the interpolation of "localRepositoryUrl"</name> + <url>@localRepositoryUrl@</url> + <mirrorOf>*</mirrorOf> + </mirror> + </mirrors> +</settings> Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/settings.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-url/src/it/settings.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java?rev=697096&r1=697095&r2=697096&view=diff ============================================================================== --- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java (original) +++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java Fri Sep 19 06:48:46 2008 @@ -1627,6 +1627,17 @@ if ( settings.getLocalRepository() != null ) { props.put( "localRepository", settings.getLocalRepository() ); + /* + * NOTE: Maven fails to properly handle percent-encoded "file:" URLs (WAGON-111) so don't use File.toURI() + * here and just do it the simple way. + */ + String url = settings.getLocalRepository(); + if ( !url.startsWith( "/" ) ) + { + url = '/' + url; + } + url = "file://" + url.replace( '\\', '/' ); + props.put( "localRepositoryUrl", url ); } return new CompositeMap( this.project, props ); } Modified: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/fast-use.apt.vm URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/fast-use.apt.vm?rev=697096&r1=697095&r2=697096&view=diff ============================================================================== --- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/fast-use.apt.vm (original) +++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/fast-use.apt.vm Fri Sep 19 06:48:46 2008 @@ -52,7 +52,7 @@ <configuration> ... <settingsFile>src/it/settings.xml</settingsFile> - ... + ... </configuration> </plugin> </plugins> @@ -76,7 +76,7 @@ <repositories> <repository> <id>local.central</id> - <url>file://@localRepository@</url> + <url>@localRepositoryUrl@</url> <releases> <enabled>true</enabled> </releases> @@ -88,7 +88,7 @@ <pluginRepositories> <pluginRepository> <id>local.central</id> - <url>file://@localRepository@</url> + <url>@localRepositoryUrl@</url> <releases> <enabled>true</enabled> </releases> @@ -102,5 +102,5 @@ </settings> ------------------- - The token <<<@localRepository@>>> will be automatically replaced by the Invoker Plugin with the path to the local + The token <<<@localRepositoryUrl@>>> will be automatically replaced by the Invoker Plugin with the URL to the local repository used for the Maven invocation. Modified: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm?rev=697096&r1=697095&r2=697096&view=diff ============================================================================== --- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm (original) +++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm Fri Sep 19 06:48:46 2008 @@ -31,12 +31,12 @@ Some files of the sub projects can be filtered, i.e. special tokens will be replaced by some other string before the actual build is started. In detail, the following files will be filtered: - * POM files selected by the include/exclude patterns. The tokens to filter must be enclosed in <<<@...@>>> to avoid - interferences with Maven's normal POM interpolation, i.e. use <<<@project.version@>>> instead of + * POM files selected by the include/exclude patterns. The tokens to be filtered must be enclosed in <<<@...@>>> to + avoid interferences with Maven's normal POM interpolation, i.e. use <<<@project.version@>>> instead of <<<$\{project.version\}>>>. Starting with version 1.3, the plugin will also (recursively) filter all POM files referenced via <<<\<parent\>>>> or <<<\<module\>>>> tags, if the projects are cloned to a temporary location. - * The custom user setting file. Again, the tokens to filter in this file must be enclosed in <<<@...@>>>. + * The custom user setting file. Again, the tokens to be filtered in this file must be enclosed in <<<@...@>>>. * The invoker properties, the goals file and the profiles file. Tokens in these files must use the usual Maven syntax <<<$\{...\}>>>. @@ -116,6 +116,8 @@ *--------------------------+----------------------------------------------------------------------------------+--------+ | <<<localRepository>>> | The absolute path to the local repository used for the main build. | 1.2 | *--------------------------+----------------------------------------------------------------------------------+--------+ +| <<<localRepositoryUrl>>> | The <<<file:>>> URL to the local repository used for the main build. | 1.3 | +*--------------------------+----------------------------------------------------------------------------------+--------+ [[3]] The properties given by the parameter <<<filterProperties>>> in the plugin configuration will be consulted for a property whose key equals the token. For the example POM shown above, the value <<<some-value>>> has been