Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to exclude a class as a maven dependency from a jar that is not built with maven?
    text
    copied!<p>I'm trying to build a simple <strong>javafx</strong> application to consume a SOAP based web service when I'm reading <em>java web services : up and running</em> book (the question is not about java web services), I'm using : - netbeans 7.3 - <a href="https://github.com/zonski/javafx-maven-plugin" rel="nofollow">javafx-maven-plugin 1.5</a> for managing dependencies (I'm using <a href="http://maven.apache.org/docs/3.0.4/release-notes.html" rel="nofollow">maven 3.0.4</a>) - <a href="http://tiwulfx.panemu.com/" rel="nofollow">tiwulfx 1.1</a> to interact with POJOs</p> <p>Here is my <strong>POM</strong> file :</p> <pre><code>&lt;groupId&gt;org.tarrsalah&lt;/groupId&gt; &lt;artifactId&gt;teams-client&lt;/artifactId&gt; &lt;version&gt;0.0.99&lt;/version&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;name&gt;teams-client&lt;/name&gt; &lt;url&gt;http://maven.apache.org&lt;/url&gt; &lt;properties&gt; &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; &lt;netbeans.hint.license&gt;apache20&lt;/netbeans.hint.license&gt; &lt;/properties&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;3.8.1&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;commons-logging&lt;/groupId&gt; &lt;artifactId&gt;commons-logging&lt;/artifactId&gt; &lt;version&gt;1.1.1&lt;/version&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;/dependency &gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.poi&lt;/groupId&gt; &lt;artifactId&gt;poi&lt;/artifactId&gt; &lt;version&gt;3.8&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.panemenu&lt;/groupId&gt; &lt;artifactId&gt;tiwulfx&lt;/artifactId&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;version&gt;1.1&lt;/version&gt; &lt;type&gt;jar&lt;/type&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;commons-beanutils&lt;/groupId&gt; &lt;artifactId&gt;commons-beanutils&lt;/artifactId&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;version&gt;1.8.3&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.jvnet.jax-ws-commons&lt;/groupId&gt; &lt;artifactId&gt;jaxws-maven-plugin&lt;/artifactId&gt; &lt;version&gt;2.2&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;wsimport&lt;/goal&gt; &lt;/goals&gt; &lt;phase&gt;generate-sources&lt;/phase&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;wsdlUrls&gt; &lt;wsdlUrl&gt;http://localhost:8080/teams?wsdl&lt;/wsdlUrl&gt; &lt;/wsdlUrls&gt; &lt;packageName&gt;org.tarrsalah.teams.client.generated&lt;/packageName&gt; &gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;com.zenjava&lt;/groupId&gt; &lt;artifactId&gt;javafx-maven-plugin&lt;/artifactId&gt; &lt;version&gt; 1.5 &lt;/version&gt; &lt;configuration&gt; &lt;mainClass&gt;org.tarrsalah.teams.client.app.App&lt;/mainClass&gt; &lt;jarFileName&gt;teams-client.jar&lt;/jarFileName&gt; &lt;vendor&gt;tarrsalah&lt;/vendor&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>I downloaded the <a href="http://tiwulfx.panemu.com/" rel="nofollow">tiwulfx</a> jar file and added all the dependencies in the <strong>POM</strong> file, and I installed it in my maven local repository (the project using netbeans/ant simple build and provide only a jar file).</p> <p>I'm trying to build a self-contained runnable jar,when I run: mvn clean compile jfx:build-jar</p> <p>I get this build error message:</p> <pre><code>[INFO] Java home is: /home/tarrsalah/local/jdk1.7.0_15/jre [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 14.445s [INFO] Finished at: Sat Feb 23 23:39:31 CET 2013 [INFO] Final Memory: 21M/350M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.zenjava:javafx-maven-plugin:1.5:build-jar (default-cli) on project teams-client: Invocation of JavaFX method 'packageAsJar' failed with an error. It's possible this plugin is not compatible with the version of JavaFX you are using. InvocationTargetException: Error: Failed to create jar file teams-client-0.0.99-jfx.jar: duplicate entry: com/javafx/main/Main.class -&gt; [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/MojoExecutionException </code></pre> <p>it seems that javafx classes already included in the <a href="http://tiwulfx.panemu.com/" rel="nofollow">tiwulfx</a> jar file and making conflict with the javafx classes in the JDK (I'm using 1.7u15) imported by the <a href="https://github.com/zonski/javafx-maven-plugin" rel="nofollow">javafx-maven-plugin</a> during the package phase.</p> <p>this is how the tree dependencies looks like:</p> <pre><code>[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building teams-client 0.0.99 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ teams-client --- [INFO] org.tarrsalah:teams-client:jar:0.0.99 [INFO] +- junit:junit:jar:3.8.1:test [INFO] +- commons-logging:commons-logging:jar:1.1.1:compile [INFO] +- org.apache.poi:poi:jar:3.8:compile [INFO] | \- commons-codec:commons-codec:jar:1.5:compile [INFO] +- com.panemenu:tiwulfx:jar:1.1:compile [INFO] \- commons-beanutils:commons-beanutils:jar:1.8.3:compile [INFO] \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate) [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.137s [INFO] Finished at: Sun Feb 24 00:21:34 CET 2013 [INFO] Final Memory: 10M/163M [INFO] ------------------------------------------------------------------------ </code></pre> <p><strong>My question is</strong>: How can I exclude the javafx classes (the package) from the <a href="http://tiwulfx.panemu.com/" rel="nofollow">tiwulfx</a> at the package phase ? it can be a trivial question because I'm new to maven ecosystem.</p> <blockquote> <p><strong>P.S: the jar generated after the operation works without any problems, I'm just trying to get a perfect build result.</strong></p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload