[MPLUGIN-101] Allow customization of file encoding used for mojo extraction
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@746415 13f79535-47bb-0310-9956-ffa450edef68master
parent
7f49d49717
commit
4ccbdfa20a
|
|
@ -273,8 +273,8 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<debug>true</debug>
|
<debug>true</debug>
|
||||||
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
|
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
|
||||||
<preBuildHookScript>setup.bsh</preBuildHookScript>
|
<preBuildHookScript>setup</preBuildHookScript>
|
||||||
<postBuildHookScript>verify.bsh</postBuildHookScript>
|
<postBuildHookScript>verify</postBuildHookScript>
|
||||||
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
|
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
|
||||||
<settingsFile>src/it/settings.xml</settingsFile>
|
<settingsFile>src/it/settings.xml</settingsFile>
|
||||||
<goals>
|
<goals>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?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/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.apache.maven.its.plugin</groupId>
|
||||||
|
<artifactId>latin-1</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>maven-plugin</packaging>
|
||||||
|
|
||||||
|
<name>Latin-1</name>
|
||||||
|
<description>
|
||||||
|
Test that source files using Latin-1 are properly parsed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
<version>2.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<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-plugin-plugin</artifactId>
|
||||||
|
<version>@project.version@</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package test;
|
||||||
|
|
||||||
|
// NOTE: This source file is by design encoded using ISO-8859-1!
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TEST-CHARS: ÄÖÜäöüß
|
||||||
|
*
|
||||||
|
* @goal test
|
||||||
|
*/
|
||||||
|
public class MyMojo
|
||||||
|
extends AbstractMojo
|
||||||
|
{
|
||||||
|
|
||||||
|
public void execute()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?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/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.apache.maven.its.plugin</groupId>
|
||||||
|
<artifactId>aggregator</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<name>Aggregator</name>
|
||||||
|
<description>
|
||||||
|
Test that the character encoding of source files is respected by the metadata extractor.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>utf-8</module>
|
||||||
|
<module>latin-1</module>
|
||||||
|
</modules>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?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/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.apache.maven.its.plugin</groupId>
|
||||||
|
<artifactId>utf-8</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>maven-plugin</packaging>
|
||||||
|
|
||||||
|
<name>UTF-8</name>
|
||||||
|
<description>
|
||||||
|
Test that source files using UTF-8 are properly parsed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
<version>2.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<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-plugin-plugin</artifactId>
|
||||||
|
<version>@project.version@</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package test;
|
||||||
|
|
||||||
|
// NOTE: This source file is by design encoded using UTF-8!
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TEST-CHARS: ßıΣЯא€
|
||||||
|
*
|
||||||
|
* @goal test
|
||||||
|
*/
|
||||||
|
public class MyMojo
|
||||||
|
extends AbstractMojo
|
||||||
|
{
|
||||||
|
|
||||||
|
public void execute()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
def latin1File = new File(basedir, 'latin-1/target/classes/META-INF/maven/plugin.xml')
|
||||||
|
assert latin1File.exists()
|
||||||
|
def latin1Chars = new XmlParser().parse(latin1File).mojos.mojo.description.text()
|
||||||
|
println latin1Chars
|
||||||
|
assert "TEST-CHARS: \u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF".equals( latin1Chars )
|
||||||
|
|
||||||
|
def utf8File = new File(basedir, 'utf-8/target/classes/META-INF/maven/plugin.xml')
|
||||||
|
assert utf8File.exists()
|
||||||
|
def utf8Chars = new XmlParser().parse(utf8File).mojos.mojo.description.text()
|
||||||
|
println utf8Chars
|
||||||
|
assert "TEST-CHARS: \u00DF\u0131\u03A3\u042F\u05D0\u20AC".equals( utf8Chars )
|
||||||
|
|
||||||
|
return true;
|
||||||
Loading…
Reference in New Issue