Reputation: 15872
Apache POI usually compiles via Ant and has some steps where the xmlbeans-Ant-task is used to transform OfficeOpenXML Schemas into code.
I am currently in the process of building a corresponding set of Maven pom.xml files which also compile the code in order to more easily run Sonar checks on Apache POI.
However a few of the generated classes look different when XMLBeans generates the code.
In the Ant-file the statement is:
<xmlbean
schema="${ooxml.encryption.xsd.dir}"
srcgendir="${ooxml.encryption.src.dir}"
optimize="yes"
destfile="${ooxml.encryption.jar}"
javasource="1.5"
failonerror="true"
fork="true"
memoryMaximumSize="${ooxml.memory}"
>
<classpath refid="ooxml.classpath"/>
</xmlbean>
In Maven I use
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.3</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>xmlbeans</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>target/schemas</schemaDirectory>
<javaSource>1.5</javaSource>
<optimize>yes</optimize>
</configuration>
</plugin>
Most classes are equal, but one has differently named getters/setters, i.e.
Ant produces
/**
* Gets the "encryptedKey" element
*/
com.microsoft.schemas.office.x2006.keyEncryptor.password.CTPasswordKeyEncryptor
getEncryptedPasswordKey();
But Maven produces a different getter, note the differently named method:
/**
* Gets the "encryptedKey" element
*/
com.microsoft.schemas.office.x2006.keyEncryptor.password.CTPasswordKeyEncryptor
getEncryptedKey();
Is there any way I can fix this? As far as I see the exact same source-XSD is used, although I know very little about XMLBeans so it could be some different setting in use here...
Upvotes: 1
Views: 1024
Reputation: 3446
Just for the sake of completness ... this could be fixed by adding the below to the configuration part:
<xmlConfigs>
<xmlConfig implementation="java.io.File">../../src/ooxml/resources/org/apache/poi/poifs/crypt</xmlConfig>
</xmlConfigs>
... so the ant task looks for the .xsdconfig files in the same dir as the .xsds, but maven needs to be instructed explicitly ...
Upvotes: 1