o Adjusted encoding default value to follow our proposal
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@746386 13f79535-47bb-0310-9956-ffa450edef68master
parent
5c42776c50
commit
a2ded7300c
|
|
@ -65,7 +65,7 @@ public abstract class AbstractGeneratorMojo
|
|||
/**
|
||||
* The file encoding of the source files.
|
||||
*
|
||||
* @parameter expression="${encoding}" default-value="ISO-8859-1"
|
||||
* @parameter expression="${encoding}" default-value="${project.build.sourceEncoding}"
|
||||
* @since 2.5
|
||||
*/
|
||||
protected String encoding;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
|||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.util.ReaderFactory;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link PluginToolsRequest}, which is used to pass parameters to components used to extract
|
||||
|
|
@ -16,7 +17,7 @@ public class DefaultPluginToolsRequest
|
|||
implements PluginToolsRequest
|
||||
{
|
||||
|
||||
public static final String DEFAULT_ENCODING = ReaderFactory.FILE_ENCODING;
|
||||
private static final String DEFAULT_ENCODING = ReaderFactory.FILE_ENCODING;
|
||||
|
||||
private PluginDescriptor pluginDescriptor;
|
||||
|
||||
|
|
@ -77,12 +78,15 @@ public class DefaultPluginToolsRequest
|
|||
*/
|
||||
public PluginToolsRequest setEncoding( String encoding )
|
||||
{
|
||||
if ( encoding == null )
|
||||
if ( StringUtils.isNotEmpty( encoding ) )
|
||||
{
|
||||
throw new IllegalArgumentException( "unspecified source file encoding" );
|
||||
this.encoding = encoding;
|
||||
}
|
||||
this.encoding = encoding;
|
||||
|
||||
else
|
||||
{
|
||||
this.encoding = DEFAULT_ENCODING;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,11 @@ public interface PluginToolsRequest
|
|||
String getEncoding();
|
||||
|
||||
/**
|
||||
* @see PluginToolsRequest#getEncoding()
|
||||
* Sets the file encoding of the source files.
|
||||
*
|
||||
* @param encoding The file encoding of the source files, may be empty or <code>null</code> to use the platform's
|
||||
* default encoding.
|
||||
* @return This request.
|
||||
*/
|
||||
PluginToolsRequest setEncoding( String encoding );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue