0

I want to use the jdt compiler in ant to compile my project, but the project with no uniform files, so i try use the home doc encoding flag: batch compiler usage.

code below:

<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" />
<property name="compiler.args" value="-encoding UTF-8 src/test/Test.java[GBK]" />
<javac destdir="${bin.dir}" includeantruntime="true" debug="true" failonerror="true" >
   <compilerarg line="${compiler.args}" />
   <src path="${src.dir}" />
   <classpath refid="compile.classpath"/>
</javac>

when i run this tasks, it will show error:
Error in D:\src\test\Test.java
public class Test {

The type Test is already defined.

How can i set the different encoding in each file? Is the path wrong?

fartpig
  • 19
  • 4
  • Does `` as child element of `` work? – howlger Nov 20 '17 at 10:30
  • Yeah, it can works, but it will need compile the src twice, each encoding in the compile. – fartpig Nov 20 '17 at 10:38
  • I understand that `src/test/Test.java[GBK]` means compile the class with the specified encoding (source + encoding), not only set the encoding for this class. Currently, `Test.java` is specified twice as source, with and without `[GBK]`. – howlger Nov 20 '17 at 11:29
  • so i must use the exclue for this case? Compile the source for the diffent encoding.Thansk. – fartpig Nov 20 '17 at 12:11

0 Answers0