Closed hujian19 closed 1 year ago
I used AdoptOpenJDK 1.8.0_292 on Mac OS 13.2.1
This is the code of the 6.7.0 release:
/**
* Special setter with value of type ValueType<br>
* Note: automatically created by ph-jaxb22-plugin -Xph-value-extender
*
* @param valueParam
* The value to be set. May be <code>null</code>.
* @return
* The created intermediary object of type CommunicationType and never <code>null</code>
*/
@Nonnull
public CommunicationType setCommunication(
@Nullable
final ValueType valueParam) {
CommunicationType aObj = getCommunication();
if (aObj == null) {
aObj = new CommunicationType(valueParam);
setCommunication(aObj);
} else {
aObj.setValue(valueParam);
}
return aObj;
}
So the difference is your aObj = new ValueType(valueParam);
Did you make some modifications to the pom.xml file??? Do you have a repository fork or so?
I don't . That's why I find it strange.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.helger.ubl</groupId>
<artifactId>ph-ubl-parent-pom</artifactId>
<version>6.7.0</version>
</parent>
<artifactId>ph-ubl23</artifactId>
<packaging>bundle</packaging>
<name>ph-ubl23</name>
<description>Library for reading and writing UBL 2.3 documents</description>
<url>https://github.com/phax/ph-ubl/ph-ubl23</url>
<inceptionYear>2019</inceptionYear>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<organization>
<name>Philip Helger</name>
<url>http://www.helger.com</url>
</organization>
<developers>
<developer>
<id>philip</id>
<name>Philip Helger</name>
<email>ph(at)helger.com</email>
<url>http://www.helger.com</url>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>com.helger.commons</groupId>
<artifactId>ph-commons</artifactId>
</dependency>
<dependency>
<groupId>com.helger.commons</groupId>
<artifactId>ph-jaxb</artifactId>
</dependency>
<dependency>
<groupId>com.helger.xsd</groupId>
<artifactId>ph-xsds-xmldsig</artifactId>
</dependency>
<dependency>
<groupId>com.helger.xsd</groupId>
<artifactId>ph-xsds-xades132</artifactId>
</dependency>
<dependency>
<groupId>com.helger.xsd</groupId>
<artifactId>ph-xsds-xades141</artifactId>
</dependency>
<dependency>
<groupId>com.helger.xsd</groupId>
<artifactId>ph-xsds-ccts-cct-schemamodule</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.helger.ubl</groupId>
<artifactId>ph-ubl-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.helger.ubl</groupId>
<artifactId>ph-ubl-testfiles</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.helger.commons</groupId>
<artifactId>ph-datetime</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Automatic-Module-Name>com.helger.ubl23</Automatic-Module-Name>
<Export-Package>com.helger.ubl23.*,
oasis.names.specification.ubl.schema.xsd.*</Export-Package>
<Import-Package>!javax.annotation.*,*</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>0.15.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<id>ubl23</id>
<configuration>
<generateDirectory>${project.build.directory}/generated-sources/ubl23</generateDirectory>
<schemaDirectory>${basedir}/src/main/resources/schemas/ubl23</schemaDirectory>
<schemaIncludes>
<schemaInclude>common/*.xsd</schemaInclude>
<schemaInclude>maindoc/*.xsd</schemaInclude>
</schemaIncludes>
<bindingIncludes>
<bindingInclude>bindings23.xjb</bindingInclude>
</bindingIncludes>
</configuration>
</execution>
</executions>
<configuration>
<bindingDirectory>${basedir}/src/main/jaxb</bindingDirectory>
<catalog>${basedir}/src/main/jaxb/catalog.txt</catalog>
<extension>true</extension>
<!-- Important for building on Linux! -->
<strict>false</strict>
<args>
<arg>-no-header</arg>
<arg>-quiet</arg>
<arg>-Xph-default-locale</arg>
<arg>en_US</arg>
<arg>-Xph-annotate</arg>
<arg>-Xph-fields-private</arg>
<arg>-Xph-code-quality</arg>
<arg>-Xph-implements</arg>
<arg>java.io.Serializable</arg>
<arg>-Xph-equalshashcode</arg>
<arg>-Xph-tostring</arg>
<arg>-Xph-list-extension</arg>
<arg>-Xph-csu</arg>
<arg>-Xph-cloneable2</arg>
<arg>-Xph-value-extender</arg>
<arg>-Xph-offset-dt-extension</arg>
</args>
<episodes>
<episode>
<groupId>com.helger.xsd</groupId>
<artifactId>ph-xsds-xmldsig</artifactId>
</episode>
<episode>
<groupId>com.helger.xsd</groupId>
<artifactId>ph-xsds-xades132</artifactId>
</episode>
<episode>
<groupId>com.helger.xsd</groupId>
<artifactId>ph-xsds-xades141</artifactId>
</episode>
<episode>
<groupId>com.helger.xsd</groupId>
<artifactId>ph-xsds-ccts-cct-schemamodule</artifactId>
</episode>
</episodes>
</configuration>
<dependencies>
<dependency>
<groupId>com.helger</groupId>
<artifactId>ph-jaxb22-plugin</artifactId>
<version>2.3.3.3</version>
</dependency>
</dependencies>
</plugin>
<!-- Delete the directory with only ObjectFactory
Source: http://stackoverflow.com/questions/32635137
-->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="${basedir}/target/generated-sources/ubl23/com/" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<doclint>none</doclint>
</configuration>
</plugin>
</plugins>
</build>
</project>
Okay, now trying with the "source code ZIP" file from 6.7.0 and this setup:
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: C:\tools\apache-maven-3.8.6
Java version: 1.8.0_362, vendor: Temurin, runtime: C:\Program Files\Eclipse Adoptium\jdk-8.0.362.9-hotspot\jre
Default locale: de_AT, platform encoding: Cp1252
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"
I think what's different is the extra methods.
/**
* Special setter with value of type String<br>
* Note: automatically created by ph-jaxb22-plugin -Xph-value-extender
*
* @param valueParam
* The value to be set. May be <code>null</code>.
* @return
* The created intermediary object of type ValueType and never <code>null</code>
*/
@Nonnull
public ValueType setCommunication(
@Nullable
final String valueParam) {
ValueType aObj = getCommunication();
if (aObj == null) {
aObj = new ValueType(valueParam);
setCommunication(aObj);
} else {
aObj.setValue(valueParam);
}
return aObj;
}
Yes, but the extra methods are also created on my side and they created correctly here. Can you please post your output of mvn -v
- thanks.
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/hujian/OpenSource/Github/framework/phax/ph-ubl -Djansi.passthrough=true -Dmaven.home=/opt/homebrew/Cellar/maven/3.8.6/libexec -Dclassworlds.conf=/opt/homebrew/Cellar/maven/3.8.6/libexec/bin/m2.conf -Dmaven.ext.class.path=/Users/hujian/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/223.8617.56/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven-event-listener.jar -javaagent:/Users/hujian/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/223.8617.56/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=65163:/Users/hujian/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/223.8617.56/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /opt/homebrew/Cellar/maven/3.8.6/libexec/boot/plexus-classworlds.license:/opt/homebrew/Cellar/maven/3.8.6/libexec/boot/plexus-classworlds-2.6.0.jar org.codehaus.classworlds.Launcher -Didea.version=2022.3.2 -s /Users/hujian/.m2/settings-docker-mac-local.xml -Dmaven.repo.local=/Users/hujian/.m2/repository -DskipTests=true -v
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/homebrew/Cellar/maven/3.8.6/libexec
Java version: 1.8.0_292, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
Process finished with exit code 0
Ah okay, so you are building from within IntelliJ. Can you please spawn a separate shell, and try building from the Shell via mvn clean install
?
I try to build on windows 8, but it was build successful.
[INFO] Running oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_23.ActualDeliveryDateTypeTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_23.ActualDeliveryDateTypeTest
[INFO] Running oasis.names.specification.ubl.schema.xsd.invoice_23.InvoiceTypeTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in oasis.names.specification.ubl.schema.xsd.invoice_23.InvoiceTypeTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 23, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-bundle-plugin:5.1.2:bundle (default-bundle) @ ph-ubl23 ---
[WARNING] Bundle com.helger.ubl:ph-ubl23:bundle:6.7.0 : Export oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_23, has 1, private references [oasis.names.specification.bdndr.schema.xsd.unqualifieddatatypes_1]
[WARNING] Bundle com.helger.ubl:ph-ubl23:bundle:6.7.0 : Export oasis.names.specification.ubl.schema.xsd.commonextensioncomponents_23, has 1, private references [oasis.names.specification.bdndr.schema.xsd.unqualifieddatatypes_1]
[WARNING] Bundle com.helger.ubl:ph-ubl23:bundle:6.7.0 : Export oasis.names.specification.ubl.schema.xsd.qualifieddatatypes_23, has 1, private references [oasis.names.specification.bdndr.schema.xsd.unqualifieddatatypes_1]
[WARNING] Bundle com.helger.ubl:ph-ubl23:bundle:6.7.0 : Export oasis.names.specification.ubl.schema.xsd.signaturebasiccomponents_23, has 1, private references [oasis.names.specification.bdndr.schema.xsd.unqualifieddatatypes_1]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 55.627 s
[INFO] Finished at: 2023-02-17T22:18:31+08:00
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ±
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ±
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ±
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ± java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ±
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ±
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ±
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ±
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ±
hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ± mvn clean install
[INFO] Scanning for projects...
Downloading from repo1: https://repo1.maven.org/maven2/org/apache/felix/maven-bundle-plugin/5.1.2/maven-bundle-plugin-5.1.2.pom
Downloaded from repo1: https://repo1.maven.org/maven2/org/apache/felix/maven-bundle-plugin/5.1.2/maven-bundle-plugin-5.1.2.pom (0 B at 0 B/s)
Downloading from repo1: https://repo1.maven.org/maven2/org/apache/felix/felix-parent/6/felix-parent-6.pom
...
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ ph-ubl23 ---
Downloading from repo1: https://repo1.maven.org/maven2/org/apache/maven/shared/maven-filtering/3.2.0/maven-filtering-3.2.0.pom
Downloaded from repo1: https://repo1.maven.org/maven2/org/apache/maven/shared/maven-filtering/3.2.0/maven-filtering-3.2.0.pom (0 B at 0 B/s)
Downloading from repo1: https://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/3.0.10/plexus-utils-3.0.10.jar
Downloading from repo1: https://repo1.maven.org/maven2/org/apache/maven/shared/maven-filtering/3.2.0/maven-filtering-3.2.0.jar
Downloaded from repo1: https://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/3.0.10/plexus-utils-3.0.10.jar (0 B at 0 B/s)
Downloaded from repo1: https://repo1.maven.org/maven2/org/apache/maven/shared/maven-filtering/3.2.0/maven-filtering-3.2.0.jar (0 B at 0 B/s)
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 102 resources
[INFO] Copying 1 resource
[INFO] Copying 1 resource to META-INF
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ ph-ubl23 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1744 source files to /Users/hujian/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/hujian/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23/target/generated-sources/ubl23/oasis/names/specification/ubl/schema/xsd/commonaggregatecomponents_23/DocumentDistributionType.java:[800,42] 不兼容的类型: oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_23.CommunicationType无法转换为oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_23.ValueType
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:09 min
[INFO] Finished at: 2023-02-17T22:47:13+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ph-ubl23: Compilation failure
[ERROR] /Users/hujian/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23/target/generated-sources/ubl23/oasis/names/specification/ubl/schema/xsd/commonaggregatecomponents_23/DocumentDistributionType.java:[800,42] 不兼容的类型: oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_23.CommunicationType无法转换为oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_23.ValueType
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
✘ hujian@192 ~/OpenSource/Github/framework/phax/ph-ubl/ph-ubl23 ➦ 75f95c9 ±
I try to build the Shell via mvn clean install, but it still failed.
Okay, so I will also try on Mac and see what I can do
Hi @phax, have you made any update?
Needed some time to get my hands on a Mac - lets see what I can find out
The error can be reproduced with this setup (using the master branch version):
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Maven home: /opt/homebrew/Cellar/maven/3.8.5/libexec
Java version: 18.0.1.1, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/18.0.1.1/libexec/openjdk.jdk/Contents/Home
Default locale: de_AT, platform encoding: UTF-8
OS name: "mac os x", version: "13.2.1", arch: "aarch64", family: "mac"
Thank you so much for taking the time to find this bug. Do you have a plan to fix this bug?
If possible, I would like you to fix it based on 6.7.0 version.
Well, the 6.7.0 binaries are available on Maven Central - just use those: https://repo1.maven.org/maven2/com/helger/ubl/ Why do you need to build them yourself?
No promises yet - depends on the solution ;-)
I found this problem when I tried to compile it. And I I added a couple of customized xsd files.
I tried to debug it, but couldn't really find something. Maybe it has something to do with Maven building in parallel? I can't reproduce it in the GitHub actions - see https://github.com/phax/ph-jaxb-plugin/actions
So, I rewrote the relevant part of the value-extender plugin and the result is more consistent. Will be part of the 4.0.2 release
Thanks a lot.
I try to build ph-ubl23 6.7.0 version, but got an error in DocumentDistributionType.java . How can I solve this problem ?
DocumentDistributionType.java