Reputation: 26415
I'm trying to build a simple javafx application to consume a SOAP based web service when I'm reading java web services : up and running book (the question is not about java web services), I'm using : - netbeans 7.3 - javafx-maven-plugin 1.5 for managing dependencies (I'm using maven 3.0.4) - tiwulfx 1.1 to interact with POJOs
Here is my POM file :
<groupId>org.tarrsalah</groupId>
<artifactId>teams-client</artifactId>
<version>0.0.99</version>
<packaging>jar</packaging>
<name>teams-client</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.hint.license>apache20</netbeans.hint.license>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency
>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>com.panemenu</groupId>
<artifactId>tiwulfx</artifactId>
<scope>compile</scope>
<version>1.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<scope>compile</scope>
<version>1.8.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<configuration>
<wsdlUrls>
<wsdlUrl>http://localhost:8080/teams?wsdl</wsdlUrl>
</wsdlUrls>
<packageName>org.tarrsalah.teams.client.generated</packageName> >
</configuration>
</plugin>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version> 1.5 </version>
<configuration>
<mainClass>org.tarrsalah.teams.client.app.App</mainClass>
<jarFileName>teams-client.jar</jarFileName>
<vendor>tarrsalah</vendor>
</configuration>
</plugin>
</plugins>
</build>
</project>
I downloaded the tiwulfx jar file and added all the dependencies in the POM file, and I installed it in my maven local repository (the project using netbeans/ant simple build and provide only a jar file).
I'm trying to build a self-contained runnable jar,when I run: mvn clean compile jfx:build-jar
I get this build error message:
[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 -> [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
it seems that javafx classes already included in the tiwulfx jar file and making conflict with the javafx classes in the JDK (I'm using 1.7u15) imported by the javafx-maven-plugin during the package phase.
this is how the tree dependencies looks like:
[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] ------------------------------------------------------------------------
My question is: How can I exclude the javafx classes (the package) from the tiwulfx at the package phase ? it can be a trivial question because I'm new to maven ecosystem.
P.S: the jar generated after the operation works without any problems, I'm just trying to get a perfect build result.
Upvotes: 2
Views: 2336
Reputation: 1398
Now TiwulFX is available in Maven.
<dependency>
<groupId>com.panemu</groupId>
<artifactId>tiwulfx</artifactId>
<version>1.1</version>
</dependency>
Thanks.
Upvotes: 2
Reputation: 32407
Since you need to add the tiwulfx
jar to your Maven repo by hand (it's not built by Maven and it's not hosted on a Maven repo anywhere), you might as well just repackage it by hand first. Just open the jar in a zip editor and delete the com/javafx
folder. Then run the usual install:install-file
goal.
When choosing a version number for the jar, it's a good idea to add an extra string to make it clear it's a slightly different jar from the one from the original website.
Upvotes: 3