Open ksrkon opened 5 years ago
Hello @jpl-jengelke Can you help me?
I follow guide but XJC don't found my XSD files when costume configuration with \
Enviroment: jaxb2-maven-plugin:2.5.0 Command: mvn jaxb2:xjc
Error Msg:
[INFO]
[INFO] --- jaxb2-maven-plugin:2.5.0:xjc (default-cli) @ SoapSample ---
[INFO] Created EpisodePath [C:\myDir\Development\WorkSpace\SoapSample\target\generated-sources\jaxb\META-INF\JAXB]: true
[INFO] Ignored given or default xjbSources [C:\myDir\Development\WorkSpace\SoapSample\src\main\xjb], since it is not an existent file or directory.
[WARNING] No XSD files found. Please check your plugin configuration.
POM.xml
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>xjc-schema1</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>src/main/resources/schemas/schema1</source>
</sources>
<!-- Package name of the generated sources. -->
<packageName>com.example.soapsample.stub.schema1</packageName>
<outputDirectory>com.example.soapsample.stub.schema1</outputDirectory>
</configuration>
</execution>
<execution>
<id>xjc-schema2</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>src/main/resources/schemas/schema2</source>
</sources>
<arguments>
<argument>-XautoNameResolution</argument>
</arguments>
<!-- Package name of the generated sources. -->
<packageName>com.example.soapsample.stub.schema2</packageName>
<!--
Don't clear the output directory before generating the sources.
Clearing the output directory removes the se.west schema from above.
-->
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
</executions>
I am also getting no XSD found when using source
tag in multiple executions. Seems like it is ignored.
@dragneelfps I solved, it's a problem of the config in the POM not of the Plugin:
For multiple executions, You have to declare the plugin dependency in PluginManagement and in Plugin but without the version: Sample:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.5.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
</plugin>
<plugins>
<build>
Actually the issue is that I assumed running mvn jaxb2:xjc
will run each execution and use its specific configuration parameters, but what happens is that it only uses plugin-level declared configuration. To run each execution separately, you need to use something like mvn jaxb2:xjc@<executionID>
. Also, an mvn package
will pick up execution level configuration properly. Not sure how that works since I dont have deep knowledge about maven yet.
@dragneelfps I realized it in mvn jaxb2:xjc
only run an execution and I stay with your tips. I execute mvn compile
for running all executions,
Hi,
I had a below requirement.
I have to generate java classes in the similar package structure where xsd files are exist using the maven plugin.
Below are the xsd file paths exist in different directories. some of these xsd files has import of another xsds too. com.test.dir1 --> test1.xsd com.test.dir2 --> test2.xsd com.test.dir3 --> test3.xsd
Now I need to generate java classes for the above xsd files and make sure that those are generated in the similar paths where xsd files exist like mentioned below.
JAxb GeneratedClasses
com.test.dir1 --> test1.java com.test.dir2--> test2.java com.test.dir3 --> test3.java
How we can achieve using the jaxb maven plugin?
Thank you.