У меня есть многомодульный проект maven, имеющий иерархию:
parent
+ ota-module
+ ota-common
+ ota-veh-avail-rate
OTA2003B (http://www.opentravel.org/Specifications/SchemaIndex.aspx?FolderName=2003B) Схемы, которые я использую:
Common:
OTA_CommonPrefs.xsd
OTA_CommonTypes.xsd
OTA_SimpleTypes.xsd
OTA_VehicleCommonTypes.xsd
VehAvailRate
OTA_VehAvailRateRQ.xsd
OTA_VehAvailRateRS.xsd
ота-модуль - pom.xml
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent</artifactId>
<groupId>com.poc.multimodule</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>ota-module</artifactId>
<packaging>pom</packaging>
<name>MultiModule OTA Parent Project</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- JiBX dependencies -->
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-run</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-extras</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-bind</artifactId>
<version>1.2.3</version>
</dependency>
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
</dependency>
</dependencies>
<modules>
<module>ota-common</module>
<module>ota-veh-avail-rate</module>
</modules>
</project>
ota-common - pom.xml
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>ota-module</artifactId>
<groupId>com.poc.multimodule</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>ota-common</artifactId>
<name>Multi Module OTA Common Project</name>
<packaging>jar</packaging>
<properties>
<ota_common_base_path>/media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common</ota_common_base_path>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>jibx-maven-plugin</artifactId>
<version>1.2.3</version>
<configuration>
<!--
<multimodule>true</multimodule>
-->
<customizations>
<customization>${ota_common_base_path}/src/main/resources/jibx/customizations/custom_a.xml</customization>
</customizations>
<schemaLocation>${ota_common_base_path}/src/main/resources/schemas/OTA2003B/Common</schemaLocation>
<includeSchemas>
<includeSchema>*.xsd</includeSchema>
</includeSchemas>
<schemaBindingDirectory>${ota_common_base_path}/src/main/java</schemaBindingDirectory>
<includeSchemaBindings>
<includeSchemaBindings>*binding.xml</includeSchemaBindings>
</includeSchemaBindings>
<options>
<u>http://www.opentravel.org/OTA/2003/05</u>
</options>
</configuration>
<executions>
<execution>
<id>generate-java-code-from-schema</id>
<goals>
<goal>schema-codegen</goal>
</goals>
</execution>
<execution>
<id>compile-jibx-binding</id>
<goals>
<goal>bind</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
custom_a.xml
<schema-set prefer-inline="true" package="com.poc.multimodule.ota.common"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
type-substitutions="xs:integer xs:int xs:decimal xs:float"
binding-file-name="base-binding.xml">
<schema name="OTA_CommonPrefs.xsd" />
<schema name="OTA_CommonTypes.xsd" />
<schema name="OTA_SimpleTypes.xsd" />
<schema name="OTA_VehicleCommonTypes.xsd">
<complexType name="VehicleProfileRentalPrefType">
<element path="**" name="VendorPref" ignore="true"/>
</complexType>
</schema>
</schema-set>
ota-veh-util-rate - pom.xml
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>ota-module</artifactId>
<groupId>com.poc.multimodule</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>ota-veh-avail-rate</artifactId>
<name>OTA Multi Module VehAvailRate Project</name>
<properties>
<ota_veh_avail_rate_base_path>/media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-veh-avail-rate</ota_veh_avail_rate_base_path>
</properties>
<dependencies>
<dependency>
<groupId>com.poc.multimodule</groupId>
<artifactId>ota-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>jibx-maven-plugin</artifactId>
<version>1.2.3</version>
<configuration>
<multimodule>true</multimodule>
<modules>
<module>com.poc.multimodule:ota-common</module>
</modules>
<customizations>
<customization>${ota_veh_avail_rate_base_path}/src/main/resources/jibx/customizations/custom_b.xml</customization>
</customizations>
<schemaLocation>${ota_veh_avail_rate_base_path}/src/main/resources/schemas/OTA2003B/VehAvailRate</schemaLocation>
<includeSchemas>
<includeSchema>OTA_VehAvailRateRQ.xsd</includeSchema>
<includeSchema>OTA_VehAvailRateRS.xsd</includeSchema>
</includeSchemas>
<schemaBindingDirectory>${ota_veh_avail_rate_base_path}/src/main/java</schemaBindingDirectory>
<includeSchemaBindings>
<includeSchemaBindings>*binding.xml</includeSchemaBindings>
</includeSchemaBindings>
<options>
<i>classpath:base-binding.xml</i>
</options>
</configuration>
<executions>
<execution>
<id>generate-java-code-from-schema</id>
<goals>
<goal>schema-codegen</goal>
</goals>
</execution>
<execution>
<id>compile-jibx-binding</id>
<goals>
<goal>bind</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
custom_b.xml
<schema-set prefer-inline="true"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
type-substitutions="xs:integer xs:int xs:decimal xs:float"
package="com.poc.multimodule.ota.vehavailrate">
<name-converter strip-prefixes="OTA_"
strip-suffixes="Type AttributeGroup Group Attributes"/>
<schema name="OTA_VehAvailRateRQ.xsd" includes="OTA_VehAvailRateRQ" />
<schema name="OTA_VehAvailRateRS.xsd" includes="OTA_VehAvailRateRS" />
</schema-set>
mvn install output :
$ mvn -e -Dskiptests=true install
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] MultiModule Parent Project
[INFO] MultiModule OTA Parent Project
[INFO] Multi Module OTA Common Project
[INFO] OTA Multi Module VehAvailRate Project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MultiModule Parent Project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ parent ---
[INFO] Installing /media/data/Practice/Maven_Multi_Module/parent/pom.xml to /media/data/Env/Local_Maven_Repository/com/poc/multimodule/parent/0.0.1-SNAPSHOT/parent-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MultiModule OTA Parent Project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ ota-module ---
[INFO] Installing /media/data/Practice/Maven_Multi_Module/parent/ota-module/pom.xml to /media/data/Env/Local_Maven_Repository/com/poc/multimodule/ota-module/0.0.1-SNAPSHOT/ota-module-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Multi Module OTA Common Project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- jibx-maven-plugin:1.2.3:schema-codegen (generate-java-code-from-schema) @ ota-common ---
[INFO] Generating Java sources in /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/src/main/java from schemas available in /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/src/main/resources/schemas/OTA2003B/Common...
Loaded and validated 4 specified schema(s)
Generated 202 top-level classes (plus 46 inner classes) in package com.poc.multimodule.ota.common
Total top-level classes in model: 202
Total classes (including inner classes) in model: 248
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ ota-common ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ ota-common ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 202 source files to /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes
[INFO]
[INFO] --- jibx-maven-plugin:1.2.3:bind (compile-jibx-binding) @ ota-common ---
[INFO] Running JiBX binding compiler (single-module mode) on 1 binding file(s)
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ ota-common ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ ota-common ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ ota-common ---
[INFO] Surefire report directory: /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ ota-common ---
[INFO] Building jar: /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/ota-common-0.0.1-SNAPSHOT.jar
[INFO] META-INF/maven/com.poc.multimodule/ota-common/pom.xml already added, skipping
[INFO] META-INF/maven/com.poc.multimodule/ota-common/pom.properties already added, skipping
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ ota-common ---
[INFO] Installing /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/ota-common-0.0.1-SNAPSHOT.jar to /media/data/Env/Local_Maven_Repository/com/poc/multimodule/ota-common/0.0.1-SNAPSHOT/ota-common-0.0.1-SNAPSHOT.jar
[INFO] Installing /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/pom.xml to /media/data/Env/Local_Maven_Repository/com/poc/multimodule/ota-common/0.0.1-SNAPSHOT/ota-common-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OTA Multi Module VehAvailRate Project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- jibx-maven-plugin:1.2.3:schema-codegen (generate-java-code-from-schema) @ ota-veh-avail-rate ---
[INFO] Generating Java sources in /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-veh-avail-rate/src/main/java from schemas available in /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-veh-avail-rate/src/main/resources/schemas/OTA2003B/VehAvailRate...
Loaded and validated 2 specified schema(s) and 4 referenced schema(s)
Generated 6 top-level classes (plus 4 inner classes) in package com.poc.multimodule.ota.vehavailrate
Total top-level classes in model: 6
Total classes (including inner classes) in model: 10
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ ota-veh-avail-rate ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ ota-veh-avail-rate ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 6 source files to /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-veh-avail-rate/target/classes
[INFO]
[INFO] --- jibx-maven-plugin:1.2.3:bind (compile-jibx-binding) @ ota-veh-avail-rate ---
[INFO] Running JiBX binding compiler (restricted multi-module mode) on 1 binding file(s)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] MultiModule Parent Project ........................ SUCCESS [0.325s]
[INFO] MultiModule OTA Parent Project .................... SUCCESS [0.006s]
[INFO] Multi Module OTA Common Project ................... SUCCESS [7.079s]
[INFO] OTA Multi Module VehAvailRate Project ............. FAILURE [0.964s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.489s
[INFO] Finished at: Tue Sep 27 16:54:14 IST 2011
[INFO] Final Memory: 28M/195M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jibx:jibx-maven-plugin:1.2.3:bind (compile-jibx-binding) on project ota-veh-avail-rate: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jibx:jibx-maven-plugin:1.2.3:bind (compile-jibx-binding) on project ota-veh-avail-rate: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes
at org.jibx.maven.AbstractBaseBindingMojo.compile(AbstractBaseBindingMojo.java:166)
at org.jibx.maven.AbstractBaseBindingMojo.execute(AbstractBaseBindingMojo.java:133)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.IllegalStateException: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes
at org.jibx.binding.classes.ClassFile.getClassGen(ClassFile.java:1286)
at org.jibx.binding.classes.ClassFile.removeMethod(ClassFile.java:1339)
at org.jibx.binding.classes.ExistingMethod.delete(ExistingMethod.java:144)
at org.jibx.binding.classes.MungedClass.purgeUnusedMethods(MungedClass.java:151)
at org.jibx.binding.classes.MungedClass.fixDispositions(MungedClass.java:381)
at org.jibx.binding.Compile.compile(Compile.java:237)
at org.jibx.maven.AbstractBaseBindingMojo.compile(AbstractBaseBindingMojo.java:163)
... 22 more
[ERROR]
[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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :ota-veh-avail-rate
Причина ошибки:
Caused by: java.lang.IllegalStateException: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes
at org.jibx.binding.classes.ClassFile.getClassGen(ClassFile.java:1286)
at org.jibx.binding.classes.ClassFile.removeMethod(ClassFile.java:1339)
at org.jibx.binding.classes.ExistingMethod.delete(ExistingMethod.java:144)
at org.jibx.binding.classes.MungedClass.purgeUnusedMethods(MungedClass.java:151)
at org.jibx.binding.classes.MungedClass.fixDispositions(MungedClass.java:381)
at org.jibx.binding.Compile.compile(Compile.java:237)
at org.jibx.maven.AbstractBaseBindingMojo.compile(AbstractBaseBindingMojo.java:163)
... 22 more
com.poc.multimodule.ota.common.ActionType - это тип, сгенерированный модулем ota-common и находящийся в сгенерированном base-binding.xml Я использую. является частью схемы OTA_SimpleTypes.xsd
ActionType определение в файле схемы
<xs:simpleType name="ActionType">
<xs:restriction base="xs:string">
<xs:enumeration value="Add-Update"/>
<xs:enumeration value="Cancel"/>
<xs:enumeration value="Delete"/>
</xs:restriction>
</xs:simpleType>
Что является причиной этого java.lang.IllegalStateException: Внутренняя ошибка - невозможно изменить класс и как решить эту проблему?
Спасибо
Jignesh