【发布时间】:2015-05-26 15:16:00
【问题描述】:
这是我第一次使用 Maven,我正在尝试从 WSDL 生成客户端。 我创建了一个 Maven 项目并从一个类似的项目中下载了一个 pom.xml 文件,然后我运行 mvn assembly:assembly 命令 build 来生成存根,但编译不起作用并产生错误。
这是我的 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.logicsector</groupId>
<artifactId>weather-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SOAP weather client</name>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.2</version>
</dependency>
</dependencies>
<build>
<finalName>weather-client</finalName>
<plugins>
<!-- Generate Java classes from WSDL during build -->
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/wsdl/weather.wsdl</wsdl>
<extraargs>
<extraarg>-client</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Add generated sources - avoids having to copy generated sources to build location -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated/src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Build the JAR with dependencies -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
<!-- Build with Java 1.5 -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
这是我得到的错误
[INFO] 正在扫描项目... [WARNING] [WARNING] 一些问题 在构建有效模型时遇到了 com.logicsector:weather-client:jar:0.0.1-SNAPSHOT [警告] 'build.plugins.plugin.version' 为 org.codehaus.mojo:build-helper-maven-plugin 丢失。 @ 第 61 行, 第 21 列 [WARNING] [WARNING] 强烈建议修复这些 问题,因为它们威胁到您构建的稳定性。 [警告] [警告] 出于这个原因,未来的 Maven 版本可能不再 支持建设此类畸形项目。 [警告] [信息]
[信息] -------------------------------------------------- ---------------------- [INFO] 构建 SOAP 天气客户端 0.0.1-SNAPSHOT [INFO] -------------------------------------------------- ---------------------- [INFO] [INFO] >>> maven-assembly-plugin:2.2-beta-5:assembly (default-cli)@weather-client >>> [INFO] [INFO] --- cxf-codegen-plugin:2.1.2:wsdl2java (generate-sources) @ weather-client --- 2015 年 3 月 23 日下午 3:11:05 org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO:正在刷新 org.apache.cxf.bus.spring.BusApplicationContext@466d9e6c:显示名称 [org.apache.cxf.bus.spring.BusApplicationContext@466d9e6c];启动 日期 [2015 年 3 月 23 日星期一 15:11:05 GMT+01:00];上下文层次的根 2015 年 3 月 23 日下午 3:11:05 org.apache.cxf.bus.spring.BusApplicationContext getConfigResources 信息:未检测到 cxf.xml 配置文件,依赖于默认值。 2015 年 3 月 23 日下午 3:11:05 org.springframework.context.support.AbstractApplicationContext 获得FreshBeanFactory INFO:应用上下文的Bean工厂 [org.apache.cxf.bus.spring.BusApplicationContext@466d9e6c]: org.springframework.beans.factory.support.DefaultListableBeanFactory@7f85e8ac 2015 年 3 月 23 日下午 3:11:06 org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker postProcessAfterInitialization 信息:Bean 'org.apache.cxf.bus.spring.Jsr250BeanPostProcessor' 不符合条件 被所有 BeanPostProcessors 处理(例如:不 符合自动代理条件)2015 年 3 月 23 日下午 3:11:06 org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker postProcessAfterInitialization 信息:Bean 'org.apache.cxf.bus.spring.BusExtensionPostProcessor' 不符合条件 被所有 BeanPostProcessors 处理(例如:不 符合自动代理条件)2015 年 3 月 23 日下午 3:11:06 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO:预实例化单例 org.springframework.beans.factory.support.DefaultListableBeanFactory@7f85e8ac: 定义 bean [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org .apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org .apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org .apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager ,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.jaxws.context.WebServiceContextResourceResolver,org.apache.cxf.jaxw s.context.WebServiceContextImpl,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.binding。 xml.XMLBindingFactory、org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder、org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider、org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder、org.apache。 cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory] ; 工厂层次结构的根 mars 23, 2015 3:11:10 PM org.springframework.context.support.AbstractApplicationContext doClose 信息:关闭 org.apache.cxf.bus.spring.BusApplicationContext@466d9e6c:显示名称 [org.apache.cxf.bus.spring.BusApplicationContext@466d9e6c];启动 日期 [2015 年 3 月 23 日星期一 15:11:05 GMT+01:00];上下文层次的根 2015 年 3 月 23 日下午 3:11:10 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons INFO: 销毁单例 org.springframework.beans.factory.support.DefaultListableBeanFactory@7f85e8ac: 定义 bean [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org .apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org .apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org .apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager ,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.jaxws.context.WebServiceContextResourceResolver,org.apache.cxf.jaxw s.context.WebServiceContextImpl,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.binding。 xml.XMLBindingFactory、org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder、org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider、org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder、org.apache。 cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory] ; 工厂层次结构的根 [INFO] -------------------------------------------------- ---------------------- [信息] 构建失败 [信息] -------------------------------------------------- ---------------------- [INFO] 总时间:9.122s [INFO] 完成时间:Mon Mar 23 15:11:10 GMT+01:00 2015 [INFO] 最终内存:21M/311M [INFO] -------------------------------------------------- ---------------------- [错误] 未能执行目标 org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java (generate-sources) 关于项目天气客户端:执行生成目标的来源 org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java 失败:非法 索引 2 处不透明部分的字符: D:\gireveWorkSpace\weather-client/src/main/wsdl/weather.wsdl -> [帮助 1] [ERROR] [ERROR] 要查看错误的完整堆栈跟踪,请重新运行 带有 -e 开关的 Maven。 [错误] 使用 -X 开关重新运行 Maven 启用完整的调试日志记录。 [错误] [错误] 有关更多信息 错误和可能的解决方案,请阅读以下文章: [错误] [帮助 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
我正在使用 Eclipse Juno 并成功配置了 Maven,请您帮我找到解决方案。
【问题讨论】:
-
你为什么要使用相当老的 CXF 版本和 JDK 1.5 版本,而你的 mvn 是使用 jdk 1.5
-
嗨 Karthik,我使用的是 Eclipse Juno,它与最新版本的 Maven 不兼容,所以我使用的是 Maven 1.4,这个版本使用旧的 CXF,这是我的想法,但我是新手,所以我将不胜感激!
-
Eclipse Juno 支持 Maven 3,
-
我尝试安装 Maven 1.5 但出现错误然后我搜索并找到了这个stackoverflow.com/questions/25454374/…
-
它不是支持 maven 任务的插件版本的 maven 版本。该插件名为m2e,
标签: web-services maven jakarta-ee wsdl cxf