I've got a problem similar to (Error compiling Java file with special characters in class name)
the scenario is as follows: i'm using jenkins to build a project that uses xmlbeans-maven-plugin:2.3.3 to generate and compile java classes from xsd. My xsd file has got some types with special characters in the name, like this:
<?xml version="1.0" encoding="ISO-8859-1"?
...
<xs:complexType name="tipoAttività">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Cod" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
when I build on my local windows7 machine, everything is Ok, when I commit on svn and build on jenkins (on a linux machine - ubuntu12.04), or if I try to build on a development unix machine, I get the error:
class TipoAttivit?Impl is public, should be declared in a file named TipoAttivit?Impl.java
I tryed to compile manually passing -enconding option to the compiler, with this result:
$ javac -encoding ISO-8859-1 TipoAttivit\?Impl.java
TipoAttivit?Impl.java:14: error: class TipoAttivitàImpl is public, should be declared in a file named TipoAttivitàImpl.java
public class TipoAttivit\u00e0Impl extends org.apache.xmlbeans.impl.values.JavaStringHolderEx implements it.honyvem.hvtola.hv2La.TipoAttivit\u00e0
Please note that the compiler prints the file name with the question mark AND prints the class name correctly with the "à" character.
I tryed to specify ISO-8859-1 encoding everywhere, but I can't get rid of the error. I suspect that the problem is in the way xmlbeans plugin generate the source files, but I didn't find any options to specify the encoding.
Here's my pom:
<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>
<build>
<finalName>xsd_honyvem_common</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>ISO-8859-1</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>ISO-8859-1</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.3</version>
<inherited>true</inherited>
<executions>
<execution>
<goals>
<goal>xmlbeans</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<schemaDirectory>src/main/resources/xsd</schemaDirectory>
<memoryInitialSize>32m</memoryInitialSize>
<memoryMaximumSize>64m</memoryMaximumSize>
<verbose>true</verbose>
<xmlConfigs>
<xmlConfig implementation="java.io.File">
src/main/resources/xsd/common.xsdconfig
</xmlConfig>
</xmlConfigs>
<noJavac>true</noJavac>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
Can someone help me?
EDIT: If I manually amend the file name like this:
$ mv TipoAttivit\?Impl.java TipoAttivitàImpl.java
The compiler seems to work fine:
$ javac -encoding ISO-8859-1 TipoAttivitàImpl.java
TipoAttivitàImpl.java:14: error: package org.apache.xmlbeans.impl.values does not exist
TipoAttivitàImpl.java:14: error: package org.apache.xmlbeans.impl.values does not exist So definitely the problem is in the way xmlbeans generates the source files.