Maven Web Service WSDL生成无法正常工作

时间:2015-04-27 18:13:08

标签: java web-services maven soap wsdl

我正在尝试将Ninja框架与仅提供SOAP的.Net Web服务一起使用。

我已经看过它的一些演示,但似乎没有任何东西可以用于我的项目。

我不是Maven或Ninja Framework的专家,所以我有点不知所措。

这是netbeans添加WSDL Web服务代码后编译的输出。

Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport (wsimport-generate-FootballDataDemo.asmx) on project serviceMain: Mojo failed - check output -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport (wsimport-generate-FootballDataDemo.asmx) on project serviceMain: Mojo failed - check output
    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:320)
    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:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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: Mojo failed - check output
    at org.jvnet.jax_ws_commons.jaxws.AbstractJaxwsMojo.exec(AbstractJaxwsMojo.java:393)
    at org.jvnet.jax_ws_commons.jaxws.WsImportMojo.processLocalWsdlFiles(WsImportMojo.java:319)
    at org.jvnet.jax_ws_commons.jaxws.WsImportMojo.execute(WsImportMojo.java:283)
    at org.jvnet.jax_ws_commons.jaxws.MainWsImportMojo.execute(MainWsImportMojo.java:50)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more


For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

这是我的pom文件。

<?xml version="1.0" encoding="UTF-8"?>
<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>

    <artifactId>serviceMain</artifactId>
    <packaging>war</packaging>
    <groupId>soccerConsumer</groupId>
    <version>1.0-SNAPSHOT</version>

    <url>http://www.ninjaframework.org</url>

    <properties>
        <ninja.version>5.1.0</ninja.version>
        <jetty.version>9.2.10.v20150310</jetty.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.3.1</version>
                <executions>
                    <execution>
                        <id>enforce-banned-dependencies</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>commons-logging</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <contextPath>/</contextPath>
                    <stopKey>stop</stopKey>
                    <stopPort>8889</stopPort>
                    <scanIntervalSeconds>1</scanIntervalSeconds>
                    <reload>automatic</reload>
                    <scanTargetPatterns>
                        <scanTargetPattern>
                            <directory>target/classes</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                            <excludes>
                                <exclude>**/*.ftl.html</exclude>
                                <exclude>assets/**</exclude>
                            </excludes>
                        </scanTargetPattern>
                    </scanTargetPatterns>
                    <systemProperties>
                        <systemProperty>
                            <name>ninja.mode</name>
                            <value>dev</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>
            <!-- Allows you to run Ninja via the SuperDevMode. -->
            <!-- run "mvn ninja:run" on the command line for the best -->
            <!-- development experience. -->
            <plugin>
                <groupId>org.ninjaframework</groupId>
                <artifactId>ninja-maven-plugin</artifactId>
                <version>${ninja.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>ninja.standalone.NinjaJetty</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <wsdlFiles>
                                <wsdlFile>www.xmlsoccer.com/FootballDataDemo.asmx.wsdl</wsdlFile>
                            </wsdlFiles>
                            <packageName>serviceDemo</packageName>
                            <wsdlLocation>http://www.xmlsoccer.com/FootballDataDemo.asmx?wsdl</wsdlLocation>
                            <staleFile>${project.build.directory}/jaxws/stale/FootballDataDemo.asmx.stale</staleFile>
                        </configuration>
                        <id>wsimport-generate-FootballDataDemo.asmx</id>
                        <phase>generate-sources</phase>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>javax.xml</groupId>
                        <artifactId>webservices-api</artifactId>
                        <version>2.0</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
                    <xnocompile>true</xnocompile>
                    <verbose>true</verbose>
                    <extension>true</extension>
                    <catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <webResources>
                        <resource>
                            <directory>src</directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>jax-ws-catalog.xml</include>
                                <include>wsdl/**</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*</include>
                </includes>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>tinymce-jquery</artifactId>
            <version>4.0.16</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.2</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>2.1.3</version>
        </dependency>        
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.182</version>
        </dependency>
        <!-- If you want to deploy to a war please -->
        <!-- comment ninja-standalone dependency and  -->
        <!-- uncomment the dependency for ninja-servlet -->
        <!--
        <dependency>
            <groupId>org.ninjaframework</groupId>
            <artifactId>ninja-servlet</artifactId>
            <version>${ninja.version}</version>
        </dependency>
        -->
        <dependency>
            <groupId>org.ninjaframework</groupId>
            <artifactId>ninja-standalone</artifactId>
            <version>${ninja.version}</version>
        </dependency>
        <dependency>
            <groupId>org.ninjaframework</groupId>
            <artifactId>ninja-test-utilities</artifactId>
            <version>${ninja.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

这是一个默认的ninja项目,直接来自忍者文档,其中使用netbeans添加了额外的Web服务。

添加webservice后,它将不再编译。

1 个答案:

答案 0 :(得分:4)

我的项目中遇到了完全相同的问题。

问题是项目文件夹的路径有空格,如下所示:

TextArea textArea = new TextArea();
textArea.setVisibleLines(5);

如果您也是这种情况,请尝试重命名您的文件夹,以便它们没有任何空格。