java - Maven Web 服务 WSDL 生成不起作用

标签 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 文档的默认 ninja 项目,使用 netbeans 添加了额外的 web 服务。

一旦添加了 web 服务,它将不再编译。

最佳答案

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

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

/somepath/school/My Projects/project

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

关于java - Maven Web 服务 WSDL 生成不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29903063/

相关文章:

web-services - 从 Informix 中的存储过程调用 Web 服务

maven - 项目是否从依赖项的父项继承 dependencyManagement

java - 使用 Maven 和 Dagger 生成的类对 Eclipse 中的 ADT 不可见

java - 使用子类的对象调用父类(super class)中的方法它是如何工作的?

java - 托管 Jar 文件

java - 如何在 wicket 中使用 zip 文件下载更大的文件?

java - 汉堡图标不显示?

web-services - 我预计youtube api v.3可以维持多长时间?

java - 区分 WebParam 中的 Null 和空集合

java - Servlet 上下文中的 NoSuchMethodError