Hello,
I think I really used a wrong work flow.
I switch to the scripts as shown as the following,
<executions>
<execution>
<id>compile</id>
<phase>generate-resources</phase>
<configuration>
<tasks>
<native2ascii encoding="UTF8" src="src/java"
dest="target/classes"
includes="**/*zh_CN.properties" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
I really didn't understand Maven build life cycle and corresponding phases.
a cup of Java, cheers!
Sha Jiang
jiangshachina wrote:
>
> Hello,
> Now I have another troubles.
> <executions>
> <execution>
> <id>compile</id>
> <phase>compile</phase>
> <configuration>
> <tasks>
> <native2ascii encoding="UTF8" src="src/java"
>
> dest="target/${project.build.finalName}/WEB-INF/classes"
> includes="**/*zh_CN.properties" />
> </tasks>
> </configuration>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> With my scripts, when Maven compiles sources,
> specific resource files will be processed by native2ascii.exe,
> then they will be putted into WAR/WEB-INF/classes.
>
> But if I set parameter archiveClasses to true for maven-war-plugin,
> two troubles shown,
> [1]directory WAR/WEB-INF/classes still existed, the resource files were in
> right format.
> [2]${project.build.finalName}.jar also existed, but the resource files
> were in wrong format. Chinese characters weren't converted to Unicode.
> May I designed a wrong work flow on the converting?
>
> a cup of Java, cheers!
> Sha Jiang
>
>
> jiangshachina wrote:
>>
>> OK, that's right!
>> Thanks very much!
>>
>> a cup of Java, cheers!
>> Sha Jiang
>>
>>
>> struberg wrote:
>>>
>>> Oki, i looked at all jars. You have to add the
>>> ant-nodeps to your dependencies also.
>>>
>>> This contains the optional ant taskdef for
>>> native2ascii.
>>>
>>> <dependency>
>>> <groupId>ant</groupId>
>>> <artifactId>ant-nodeps</artifactId>
>>> <version>1.6.5</version>
>>> <scope>runtime</scope>
>>> </dependency>
>>>
>>> lg,
>>> strub
>>>
>>>
>>> --- jiangshachina <[EMAIL PROTECTED]> schrieb:
>>>
>>>>
>>>> Hi struberg,
>>>> Thanks for your help.
>>>> I had a try with your instructions, but didn't get
>>>> good result.
>>>> The following is my snippet of scripts
>>>> <dependency>
>>>> <groupId>com.sun</groupId>
>>>> <artifactId>tools</artifactId>
>>>> <version>1.5.0_09</version>
>>>> <scope>system</scope>
>>>> <systemPath>
>>>> C:\setup\java\jdk1.5.0_09\lib\tools.jar
>>>> </systemPath>
>>>> </dependency>
>>>>
>>>> The error and information are below,
>>>> [ERROR] BUILD ERROR
>>>> [INFO]
>>>>
>>> ------------------------------------------------------------------------
>>>> [INFO] Error executing ant tasks
>>>>
>>>> Embedded error: Could not create task or type of
>>>> type: native2ascii.
>>>>
>>>> Ant could not find the task or a class this task
>>>> relies upon.
>>>>
>>>> This is common and has a number of causes; the usual
>>>>
>>>> solutions are to read the manual pages then download
>>>> and
>>>> install needed JAR files, or fix the build file:
>>>> - You have misspelt 'native2ascii'.
>>>> Fix: check your spelling.
>>>> - The task needs an external JAR file to execute
>>>> and this is not found at the right place in the
>>>> classpath.
>>>> Fix: check the documentation for dependencies.
>>>> Fix: declare the task.
>>>> - The task is an Ant optional task and the JAR file
>>>> and/or libraries
>>>> implementing the functionality were not found
>>>> at the time you
>>>> yourself built your installation of Ant from
>>>> the Ant sources.
>>>> Fix: Look in the ANT_HOME/lib for the 'ant-' JAR
>>>> corresponding to the
>>>> task and make sure it contains more than merely
>>>> a META-INF/MANIFEST.MF.
>>>> If all it contains is the manifest, then
>>>> rebuild Ant with the needed
>>>> libraries present in ${ant.home}/lib/optional/
>>>> , or alternatively,
>>>> download a pre-built release version from
>>>> apache.org
>>>> - The build file was written for a later version of
>>>> Ant
>>>> Fix: upgrade to at least the latest release
>>>> version of Ant
>>>> - The task is not an Ant core or optional task
>>>> and needs to be declared using <taskdef>.
>>>> - You are attempting to use a task defined using
>>>> <presetdef> or <macrodef> but have spelt wrong
>>>> or not
>>>> defined it at the point of use
>>>>
>>>> Remember that for JAR files to be visible to Ant
>>>> tasks implemented
>>>> in ANT_HOME/lib, the files must be in the same
>>>> directory or on the
>>>> classpath
>>>>
>>>> Please neither file bug reports on this problem, nor
>>>> email the
>>>> Ant mailing lists, until all of these causes have
>>>> been explored,
>>>> as this is not an Ant bug.
>>>>
>>>> The error and information is as the same as that at
>>>> last time.
>>>> It's the first time of using system scope, may I
>>>> don't understand the scope
>>>> well.
>>>>
>>>> a cup of Java, cheers!
>>>> Sha Jiang
>>>>
>>>>
>>>> struberg wrote:
>>>> >
>>>> > Hi Jiang!
>>>> >
>>>> > This task is a bit tricky, since the antrun plugin
>>>> > does come with almost no dependencies in the
>>>> default
>>>> > pom. This is basically a good idea, since you
>>>> don't
>>>> > have jars lying around which you do not use.
>>>> >
>>>> > Specially the native2ascii is a bit dirty, since
>>>> this
>>>> > is a special part provided by the sun tools set
>>>> and
>>>> > not the jre libs itself.
>>>> >
>>>> > Sosince, as sigi pointed out a few weeks ago, you
>>>> > have to add the needed dependency yourself.
>>>> >
>>>> >
>>>> > I guess it's the com.sun.tools you have to add to
>>>> your
>>>> > antrun dependencies:
>>>> >
>>>> >
>>>> > <plugin>
>>>> > <artifactId>maven-antrun-plugin</artifactId>
>>>> > ...
>>>> > <dependencies>
>>>> > <dependency>
>>>> > <groupId>com.sun</groupId>
>>>> > <artifactId>tools</artifactId>
>>>> > <scope>system</scope>
>>>> >
>>>> >
>>>>
>>> <systemPath>${java.home}/../lib/tools.jar</systemPath>
>>>> > </dependency>
>>>> > </dependencies>
>>>> > </plugin>
>>>> >
>>>> > lg,
>>>> > strub
>>>> >
>>>> >
>>>> > --- jiangshachina <[EMAIL PROTECTED]>
>>>> schrieb:
>>>> >
>>>> >>
>>>> >> Hi guys,
>>>> >> I must write some resource files related to
>>>> >> localization.
>>>> >> On develop time, I have to write natural local
>>>> >> language; on runtime,
>>>> >> application must use ASCII codes.
>>>> >> So I have to convert the native resource files to
>>>> >> ASCII files before
>>>> >> deploying.
>>>> >>
>>>> >> Now, I use maven-antrun-plugin to execute Ant
>>>> task
>>>> >> native2ascii.
>>>> >> The following is my scripts on the work,
>>>> >> <plugin>
>>>> >> <groupId>org.apache.maven.plugins</groupId>
>>>> >> <artifactId>maven-antrun-plugin</artifactId>
>>>> >> <executions>
>>>> >> <execution>
>>>> >> <id>resources</id>
>>>> >> <phase>process-resources</phase>
>>>> >> <configuration>
>>>> >> <tasks>
>>>> >> <native2ascii reverse="true"
>>>> >> encoding="UTF8"
>>>> >>
>>>> >> src="target/sodoperation/WEB-INF/classes"
>>>> >>
>>>> >> dest="target/sodoperation/WEB-INF/classes"
>>>> >>
>>>> >> includes="**/*zh_CN.properties" />
>>>> >> </tasks>
>>>> >> </configuration>
>>>> >> <goals>
>>>> >> <goal>run</goal>
>>>> >> </goals>
>>>> >> </execution>
>>>> >> </executions>
>>>> >> <dependencies>
>>>> >> <dependency>
>>>> >> <groupId>ant</groupId>
>>>> >> <artifactId>ant-antlr</artifactId>
>>>> >> <version>1.6.5</version>
>>>> >> </dependency>
>>>> >> <dependency>
>>>> >> <groupId>antlr</groupId>
>>>> >> <artifactId>antlrall</artifactId>
>>>> >> <version>2.7.4</version>
>>>> >> </dependency>
>>>> >> </dependencies>
>>>> >> </plugin>
>>>> >> When I run "mvn package", an error thrown,
>>>> >> [ERROR] BUILD ERROR
>>>> >> [INFO]
>>>> >>
>>>> >
>>>>
>>> ------------------------------------------------------------------------
>>>> >> [INFO] Error executing ant tasks
>>>> >> Embedded error: Could not create task or type of
>>>> >> type: native2ascii.
>>>> >> Ant could not find the task or a class this task
>>>> >> relies upon.
>>>> >> ......
>>>> >>
>>>> >> I need some another jars?
>>>> >> How to resolve the problem?
>>>> >> Thanks in advance.
>>>>
>>> === message truncated ===
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ___________________________________________________________
>>> Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail:
>>> http://mail.yahoo.de
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/How-to-do-%22native2ascii%22--tf2710959s177.html#a7576186
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]