You are right. I changed my pom.xml as follow. This time it should be portable:
... <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>1.10</version> <executions> <execution>
<goals> <goal>wsgen</goal> </goals> </execution> </executions> <configuration> <sei>com.MyWeb</sei> <!--for demo purpose only, the webapp does not -->
<!--need the generated wsdl files --> <genWsdl>true</genWsdl> <keep>true</keep> </configuration> <dependencies> <dependency> <groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId> <version>2.1.3</version> </dependency> </dependencies> </plugin>
--- Anders Hammar <anders@xxxxxxxxxx> schrieb am Fr, 9.9.2011:
Von: Anders Hammar <anders@xxxxxxxxxx> Betreff: Re: [m2e-users] Cannot create the wsdl by using plugin wsgen An: "Maven Integration for Eclipse users mailing list" <m2e-users@xxxxxxxxxxx> Datum: Freitag, 9. September, 2011 09:40
Uhr
No, you're using the discontinued plugin. Check the site for that plugin: http://mojo.codehaus.org/jaxws-maven-plugin//Anders
On Fri, Sep 9, 2011 at 08:08, Thomas Chang <thomas2004ch@xxxxxxxx> wrote:
I surely do use the plugin you mentioned. This is what I used formerly. The <plugin/> section in my pom.xml looks now as follow:
... <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>1.10</version>
<dependencies> <dependency>
<groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.0</version> <scope>system</scope>
<systemPath>C:/Program Files/Java/jdk1.7.0/lib/tools.jar</systemPath> </dependency>
</dependencies> <executions> <execution> <goals> <goal>wsgen</goal>
</goals> <configuration>
<sei>com.MyWeb</sei> <!--for demo purpose only, the webapp does not --> <!--need the generated wsdl files --> <genWsdl>true</genWsdl>
<keep>true</keep> </configuration>
</execution> </executions> </plugin> ...
Here you can see I've insert the <dependency/>, othwerwise I will get ClassNotFoundException.
--- Anders Hammar <anders@xxxxxxxxxx> schrieb am Do, 8.9.2011:
Datum: Donnerstag, 8. September, 2011 15:40 UhrPlease note that this is not a portable solution and therefore not something I recommend. Did you check the other plugin I
mentioned? /Anders On Thu, Sep 8, 2011 at 15:12, Thomas Chang <thomas2004ch@xxxxxxxx> wrote:
The problem is solved after I added the following code in the plugin section:
<dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.0</version>
<scope>system</scope>
<systemPath>C:/Program Files/Java/jdk1.7.0/lib/tools.jar</systemPath> </dependency>
Mi, 7.9.2011:
Datum: Mittwoch, 7. September, 2011 12:07 UhrYou could try adding a dependency to the tools.jar for the plugin. But reading over at Mojo, the plugin you're using is deprecated in favor of this one:
http://jax-ws-commons.java.net/jaxws-maven-plugin/
I would switch plugin if I was you. Questions regarding these specific plugin don't really fit here. Please move them to the appropriate mailing list. If you don't find one, you could ask at the generic Maven users list.
/Anders On Wed, Sep 7, 2011 at 11:45, Thomas Chang <thomas2004ch@xxxxxxxx> wrote:
Now I change the pom.xml as you wrote as follow:
... <plugins> <plugin>
<groupId>org.codehaus.mojo</groupId> <artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version> <executions>
<execution>
<goals> <goal>wsgen</goal> </goals>
<configuration> <sei>com.MyWeb</sei>
<!--for demo purpose only, the webapp does not--> <!--need the generated wsdl files-->
<genWsdl>true</genWsdl> <keep>true</keep> </configuration> </execution> </executions>
</plugin> ...
I run mvn clean install again in command console. And I can see it tries to compile the wsgen plugin but got error as follow:
... [INFO] Compiling 1 source file to
D:\Temp\MyProjects\TestWebService\target\classes [INFO] [INFO] --- jaxws-maven-plugin:1.10:wsgen (default) @ TestWebService --- [INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.422s [INFO] Finished at: Wed Sep 07 11:36:56 CEST 2011 [INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxws-maven-plugin:1.10:wsgen (default) on project TestWebService: Failed to execute wsgen: com/sun/mirror/apt/AnnotationProcessorFactory: com.sun.mirror.apt.AnnotationProcessorFactory -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:jaxws-maven-plugin:1.10:wsgen (default) on project TestWebService: Failed to
execute wsgen 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:57) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) 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: Failed to execute wsgen at org.codehaus.mojo.jaxws.AbstractWsGenMojo.execute(AbstractWsGenMojo.java:102) at
org.codehaus.mojo.jaxws.MainWsGenMojo.execute(MainWsGenMojo.java:14) 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.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at
java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42) at
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230) at com.sun.tools.ws.WsGen.doMain(WsGen.java:69)
at org.codehaus.mojo.jaxws.AbstractWsGenMojo.execute(AbstractWsGenMojo.java:97) ... 22 more Caused by: java.lang.ClassNotFoundException: com.sun.mirror.apt.AnnotationProcessorFactory at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244) at
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230) ... 37 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 ...
I can't understand why the class 'com.sun.mirror.apt.AnnotationProcessorFactory' not found since this is in the tools.jar.
Besides, according to the hints I've read the http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException. But htis doesn't help.Mi, 7.9.2011:
Datum: Mittwoch, 7. September, 2011 10:18 UhrAs I said, it is not bound to the lifecycle! For now, please ignore m2e and just think Maven. Get things to work from command line and then go on to m2e.
Here's another take on it: http://pragmaticjava.blogspot.com/2011/08/customizing-mavens-lifecycle.html
You need to add the plugin as a binding through project/build/plugins/plugin/ in the pom. /Anders On Wed, Sep 7, 2011 at 10:03, Thomas Chang <thomas2004ch@xxxxxxxx> wrote:
I run this in command console with mvn clean install and got followings:
... Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ TestWebService --- [INFO] Packaging webapp [INFO] Assembling webapp [TestWebService] in [D:\Temp\MyProjects\TestWebService\target\TestWebService]
[INFO] Processing war project [INFO] Copying webapp resources [D:\Temp\MyProjects\TestWebService\src\main\webapp] [INFO] Webapp assembled in [93 msecs] [INFO] Building war: D:\Temp\MyProjects\TestWebService\target\TestWebService.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored (webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true') [INFO] [INFO] --- maven-install-plugin:2.3.1:install
(default-install) @ TestWebService --- [INFO] Installing D:\Temp\MyProjects\TestWebService\target\TestWebService.war to d:\daten\maven2-local\com\mycompany\app\TestWebService\1.0- SNAPSHOT\TestWebService-1.0-SNAPSHOT.war
[INFO] Installing D:\Temp\MyProjects\TestWebService\pom.xml to d:\daten\maven2-local\com\mycompany\app\TestWebService\1.0-SNAPSHOT\TestWebSe rvice-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.453s [INFO] Finished at: Wed Sep 07 10:00:51 CEST 2011 [INFO] Final Memory: 9M/23M
[INFO] ------------------------------------------------------------------------
...
The result is successful but I couldn't find the wsdl file and couldn't see the plugin really executed.Mi, 7.9.2011:
Datum: Mittwoch, 7. September, 2011 09:43 UhrYou still need to declare a binding in the pom (unless you have a custom packaging type which already includes this). All this i very easy to find out by executing from command line. Does it work there? Check the console output and verify that the plugin really executes.
/Anders On Wed, Sep 7, 2011 at 09:29, Stephen Coy <steve@xxxxxxxxxxxxx> wrote:
This plugin is bound by default to the "process-classes" phase for the ws-gen goal. I think the problem is that there is not yet an m2e connector for this plugin. The OP can still run a regular "maven install" from inside eclipse as he did before and this will work (I do it every day for the ws-import goal).
Cheers
Steve C On 07/09/2011, at 5:09 PM, Anders Hammar wrote: Well, your issue is a basic Maven issue. You have not bound the execution of the plugin to the maven build lifecycle. You have merely created a m2e configuration, which I guess m2e ignores as the plugin is not bound to the lifecycle.
Read this: http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
/Anders
On Wed, Sep 7, 2011 at 08:58, Thomas Chang <thomas2004ch@xxxxxxxx> wrote:
You can find the code in the pom.xml as follow:
...
<artifactId>jaxws-maven-plugin</artifactId>
...
Doesn't it mean the jaxws-plugin not bound?
Thomas
--- Anders Hammar <anders@xxxxxxxxxx> schrieb am Mi, 7.9.2011:
Von: Anders Hammar <anders@xxxxxxxxxx>
Betreff: Re: [m2e-users] Cannot create the wsdl by using plugin wsgen
An: "Maven Integration for Eclipse users mailing list" <m2e-users@xxxxxxxxxxx> Datum: Mittwoch, 7. September, 2011 08:34 Uhr
But the jaxws plugin hasn't been bound to the lifecycle? /Anders On Wed, Sep 7, 2011 at 08:09, Thomas Chang <thomas2004ch@xxxxxxxx> wrote:
Hi all,
Formerly I use the maveb 2.0.8 and can use the wsgen plugin to create the wsdl file in eclipse by running mvn package or mvn install.
Now I change to use the maven 3.0.3 and I can't create the wsdl anymore. Here is my 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.mycompany.app</groupId> <artifactId>TestWebService</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version>
<name>TestWebService Maven Webapp</name> <url>http://maven.apache.org</url> <pluginRepositories> <pluginRepository>
<id>maven2-repository.dev.java.net</id> <url>http://download.java.net/maven/2/</url>
</pluginRepository> </pluginRepositories> <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> </dependency> <!-- jax-ws --> <dependency> <groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId> <version>2.1.5</version> <exclusions> <exclusion> <groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId> </exclusion> <exclusion>
<groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> </exclusion> <exclusion> <groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId> </exclusion> <exclusion>
<groupId>javax.xml.soap</groupId> <artifactId>saaj-api</artifactId> </exclusion> <exclusion> <groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId> </exclusion> </exclusions> </dependency>
<dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.1</version> <scope>provided</scope>
</dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.1.9</version>
</dependency>
<dependency> <groupId>javax.xml.stream</groupId> <artifactId>stax-api</artifactId> <version>1.0-2</version> <scope>provided</scope>
</dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.6.2</version>
</dependency>
</dependencies> <build> <finalName>TestWebService</finalName> <plugins> <plugin> <groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata>
<pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<versionRange>1.10</versionRange> <goals> <goal>wsgen</goal> </goals>
</pluginExecutionFilter>
<action> <execute /> </action> </pluginExecution> </pluginExecutions>
</lifecycleMappingMetadata>
</configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <skip>true</skip> </configuration> </plugin>
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source>
<target>1.5</target> </configuration> </plugin> </plugins>
</build> </project>
Cheers
Thomas
|
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
-----Integrierter Anhang folgt-----
|
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
_______________________________________________ m2e-users mailing list m2e-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/m2e-users
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
-----Integrierter Anhang folgt----- |
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
-----Integrierter Anhang folgt----- |
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
-----Integrierter Anhang folgt----- |
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
-----Integrierter Anhang folgt----- |
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
-----Integrierter Anhang folgt-----
|