This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 94f84ec39d458e3c6dff035cd82a4b1778aad276
Author: Zoran Regvart <[email protected]>
AuthorDate: Tue Jul 3 14:35:41 2018 +0200

    CAMEL-12614: add javax.xml.bind.DatatypeConvert...
    
    ...er in camel-asn1 on Java 9+
    
    I had to use the `exec` goal instead of the `java` goal in order to have
    the ability to control the classpath needed to add the jaxb-api
    dependency. Just adding the jaxb-api dependency in the `java` goal
    configuration lead to NullPointerException.
---
 components/camel-asn1/pom.xml | 83 ++++++++++++++++++++++++-------------------
 1 file changed, 47 insertions(+), 36 deletions(-)

diff --git a/components/camel-asn1/pom.xml b/components/camel-asn1/pom.xml
index 15c578d..641521f 100644
--- a/components/camel-asn1/pom.xml
+++ b/components/camel-asn1/pom.xml
@@ -95,6 +95,22 @@
       <artifactId>commons-io</artifactId>
       <scope>test</scope>
     </dependency>
+
+    <!-- these optional dependencies are needed because exec plugin
+         doesn't obbey the plugin's dependencies and only supports
+         compile and runtime dependencies -->
+    <dependency>
+      <groupId>org.openmuc</groupId>
+      <artifactId>jasn1-compiler</artifactId>
+      <version>${jasn1-version}</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>${jaxb-version}</version>
+      <optional>true</optional>
+    </dependency>
   </dependencies>
   
   <build>
@@ -102,43 +118,38 @@
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>exec-maven-plugin</artifactId>
-         <executions>
-           <execution>
-             <id>generate-test-sources</id>
-             <phase>generate-sources</phase>
-             <goals>
-               <goal>java</goal>
-             </goals>
-             <configuration>
-               <includeProjectDependencies>false</includeProjectDependencies>
-               <includePluginDependencies>true</includePluginDependencies>
-               
<testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
-               <executableDependency>
-                 <groupId>org.openmuc</groupId>
-                 <artifactId>jasn1-compiler</artifactId>
-               </executableDependency>
-               <mainClass>org.openmuc.jasn1.compiler.Compiler</mainClass>
-               <arguments>
-                 <argument>-o</argument>
-                 <argument>${basedir}/target/generated/src/test/java</argument>
-                 <argument>-p</argument>
-                 <argument>org.apache.camel.dataformat.asn1.model</argument>
-                 <argument>-f</argument>
-                 
<argument>${basedir}/src/test/resources/asn1_structure/TestSMSCBerCdr.asn1</argument>
-                 <argument>-il</argument>
-               </arguments>
-             </configuration>
-           </execution>
-         </executions>
-         <dependencies>
-           <dependency>
-             <groupId>org.openmuc</groupId>
-             <artifactId>jasn1-compiler</artifactId>
-             <version>${jasn1-version}</version>
-           </dependency>
-         </dependencies>
+        <executions>
+          <execution>
+            <id>generate-test-sources</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>java</executable>
+              <arguments>
+                <argument>-classpath</argument>
+                <classpath>
+                  <dependency>org.openmuc:jasn1-compiler</dependency>
+                  <dependency>org.openmuc:jasn1</dependency>
+                  <dependency>antlr:antlr</dependency>
+                  <dependency>javax.xml.bind:jaxb-api</dependency>
+                </classpath>
+                <argument>org.openmuc.jasn1.compiler.Compiler</argument>
+                <argument>-o</argument>
+                <argument>${basedir}/target/generated/src/test/java</argument>
+                <argument>-p</argument>
+                <argument>org.apache.camel.dataformat.asn1.model</argument>
+                <argument>-f</argument>
+                
<argument>${basedir}/src/test/resources/asn1_structure/TestSMSCBerCdr.asn1</argument>
+                <argument>-il</argument>
+              </arguments>
+              
<testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
+              <longModulepath>false</longModulepath>
+            </configuration>
+          </execution>
+        </executions>
       </plugin>
     </plugins>
   </build>
-
 </project>

Reply via email to