[ http://jira.codehaus.org/browse/ARCHETYPE-19?page=comments#action_62520 ] 

Adolfo Garcia commented on ARCHETYPE-19:
----------------------------------------

The patch 
[MNG-19-maven-archetype.patch|http://jira.codehaus.org/secure/attachment/19902/MNG-19-maven-archetype.patch]
 corrects this issue by adding a couple of attributes to the <source> and 
<resource> elements of the archetype descriptor (archetype.xml). Sources can 
specify an encoding and resources if they should be filtered and their 
encoding. For example, you could have the following archetype descriptor:

{code:title=archetype.xml|borderStyle=solid}
<archetype>
  <id>myArchetypeId</id>
  <sources>
    <source encoding="utf-8">src/main/java/MyApp.java</source>
  </sources>
  <resources>
    <resource filtered="false">src/main/resources/image.png</resource>
    <resource encoding="iso-8859-1">src/main/resources/index.html</resource>
    <resource>src/main/resources/labels.properties</resource>
  </resources>
  <testSources>
    <source>src/test/java/MyAppTest.java</source>
  </testSources>
</archetype>
{code}


In the previous example, the encoding of {{MyApp.java}} is {{utf-8}}, while 
that of {{MyAppTest.java}} will be assumed to be the default for the JVM, 
{{image.png}} will not be filtered (processed with Velocity), {{index.html}} 
will be processed, but non-ascii characters will not be broken, since its 
encoding ({{iso-8859-1}}) will be preserved, and {{labels.properties}} will be 
processed using the encoding used by [all property 
files|http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html] 
({{iso-8859-1}}).

Now, the attribute *{{encoding}}* defines the encoding used by the source or 
resource file, so characters are not broken while creating the project, and the 
attribute *{{filtered}}* defines if the resource should be processed at all by 
Velocity. Until now, images in an archetype were filtered and broken each time 
a project was created.

By default all sources, resources, test-sources, test-resources and 
site-resources are filtered, and it is assumed they use the default Java 
virtual machine's encoding (just as before, so it is backwards compatible).


> archetype creation broken
> -------------------------
>
>          Key: ARCHETYPE-19
>          URL: http://jira.codehaus.org/browse/ARCHETYPE-19
>      Project: Maven Archetype
>         Type: Bug

>   Components: maven-archetype-plugin
>     Reporter: Jorg Heymans
>     Assignee: Jason van Zyl
>  Attachments: MNG-19-maven-archetype.patch
>
>
> - when creating an archetype ie doing "archetype:create", the template 
> substitution routines mangle characters like © .
> - binary files are also searched through for substitution this often results 
> in exceptions and failed creation.
> I think the archetype desperately needs a way of switching off template 
> substitution for anything else but pom.xml. It's hardly useable for us in 
> it's present form. 
> I can create a testcase if necessary, just ask.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to