Author: krosenvold Date: Sat Nov 29 09:58:46 2014 New Revision: 1642407 URL: http://svn.apache.org/r1642407 Log: [MASSEMBLY-736] .properties files are interpolated with UTF-8
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/invoker.properties maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/pom.xml maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/assembly/ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/assembly/descriptor.xml maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/aTextFileISO8859-1.txt maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/file-1.properties maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-assembly.properties maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-build.properties maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/verify.bsh Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReaderFormatter.java Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/invoker.properties?rev=1642407&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/invoker.properties (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/invoker.properties Sat Nov 29 09:58:46 2014 @@ -0,0 +1,17 @@ +# 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. +invoker.goals=clean package Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/pom.xml?rev=1642407&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/pom.xml (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/pom.xml Sat Nov 29 09:58:46 2014 @@ -0,0 +1,64 @@ +<?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> + <parent> + <groupId>org.apache.maven.plugin.assembly.test</groupId> + <artifactId>it-project-parent</artifactId> + <version>1</version> + </parent> + + <artifactId>filters-defined-in-build</artifactId> + <packaging>pom</packaging> + + <build> + <filters> + <filter>${basedir}/src/main/filters/filter-build.properties</filter> + </filters> + + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>${basedir}/src/main/assembly/descriptor.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + <escapeString>\</escapeString> + </configuration> + <executions> + <execution> + <id>single-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <anExpr>über</anExpr> + </properties> +</project> Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/assembly/descriptor.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/assembly/descriptor.xml?rev=1642407&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/assembly/descriptor.xml (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/assembly/descriptor.xml Sat Nov 29 09:58:46 2014 @@ -0,0 +1,41 @@ +<?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. +--> + +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + + <id>assembly</id> + + <formats> + <format>dir</format> + </formats> + + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>${basedir}/src/main/config</directory> + <outputDirectory></outputDirectory> + <lineEnding>unix</lineEnding> + <filtered>true</filtered> + </fileSet> + </fileSets> + +</assembly> Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/aTextFileISO8859-1.txt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/aTextFileISO8859-1.txt?rev=1642407&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/aTextFileISO8859-1.txt (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/aTextFileISO8859-1.txt Sat Nov 29 09:58:46 2014 @@ -0,0 +1 @@ +Bjørn is cool ${anExpr} Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/file-1.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/file-1.properties?rev=1642407&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/file-1.properties (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/config/file-1.properties Sat Nov 29 09:58:46 2014 @@ -0,0 +1,18 @@ +# 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. +bøs=${anExpr} + Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-assembly.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-assembly.properties?rev=1642407&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-assembly.properties (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-assembly.properties Sat Nov 29 09:58:46 2014 @@ -0,0 +1,18 @@ +# 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. + +filter.assembly=Filter defined in the Assembly plugin's configuration. Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-build.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-build.properties?rev=1642407&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-build.properties (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/src/main/filters/filter-build.properties Sat Nov 29 09:58:46 2014 @@ -0,0 +1,18 @@ +# 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. + +filter.build=Filter defined in the projects' build section. Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/verify.bsh URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/verify.bsh?rev=1642407&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/verify.bsh (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/filtering-feature/massembly-736/verify.bsh Sat Nov 29 09:58:46 2014 @@ -0,0 +1,41 @@ +/* + * 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. + */ + +import java.io.*; +import java.net.*; +import java.util.jar.*; + +try +{ + File file = new File( basedir, "target/filters-defined-in-build-1/file-1.properties"); + Properties properties = new Properties( ); + properties.load( new FileInputStream( file ) ); + String value = properties.get("b\u00f8s"); + + if (!value.equals("\u00FCber")){ + System.out.println("Expected über, found:" + value); + return false; + } + return true; +} +catch( IOException e ) +{ + e.printStackTrace(); + return false; +} Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReaderFormatter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReaderFormatter.java?rev=1642407&r1=1642406&r2=1642407&view=diff ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReaderFormatter.java (original) +++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReaderFormatter.java Sat Nov 29 09:58:46 2014 @@ -110,12 +110,12 @@ public class ReaderFormatter InputStream result = inputStream; if ( isFiltered ) { - final String encoding = configSource.getEncoding(); + boolean isPropertyFile = AssemblyFileUtils.isPropertyFile( plexusIoResource.getName() ); + final String encoding = isPropertyFile ? "ISO-8859-1" : configSource.getEncoding(); Reader source = encoding != null ? new InputStreamReader( inputStream, encoding ) : new InputStreamReader( inputStream ); // wtf platform encoding ? TODO: Fix this - boolean isPropertyFile = AssemblyFileUtils.isPropertyFile( plexusIoResource.getName() ); Reader filtered = createReaderFilter( source, configSource.getEscapeString(), configSource.getDelimiters(), configSource, isPropertyFile );