0

我正在尝试按照http://cxf.apache.org/setting-up-eclipse.html上的说明设置 Apache CXF v2.7.7(使用 Maven 3.1.0 设置)以在 Eclipse WTP(Kepler Service Release 1) 在我的 win7 64 位笔记本电脑上。我能够成功地将所有三个插件(CheckStyle、PMD、Subversion)添加到 Eclipse,但是在创建工作区时,我遇到了两个问题:

1.) 指向“首先从 Subversion 中检查 CXF ”的方向。对我来说毫无意义。该页面将我引导至“svn co {URL}”命令的三种不同变体,但我没有明显的 svn 批处理或可执行文件,因为我所做的只是安装插件。不知道我应该在这里做什么。

2.)“mvn -Pfastinstall”运行良好,但“mvn -Psetup.eclipse”命令在数据绑定步骤中退出:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.9
:eclipse (setup.eclipse.project) on project cxf-systests-databinding: Cant canon
icalize system path: {0}: The filename, directory name, or volume label syntax i
s incorrect -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse (setup.eclipse.project)
 on project cxf-systests-databinding: Cant canonicalize system path: {0}
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:216)
        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.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:414)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
357)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cant canonicalize sys
tem path: {0}
        at org.apache.maven.plugin.ide.IdeUtils.getCanonicalPath(IdeUtils.java:1
47)
        at org.apache.maven.plugin.ide.IdeUtils.toRelativeAndFixSeparator(IdeUti
ls.java:591)
        at org.apache.maven.plugin.eclipse.EclipsePlugin.extractResourceDirs(Ecl
ipsePlugin.java:1787)
        at org.apache.maven.plugin.eclipse.EclipsePlugin.buildDirectoryList(Ecli
psePlugin.java:1684)
        at org.apache.maven.plugin.eclipse.EclipsePlugin.createEclipseWriterConf
ig(EclipsePlugin.java:1359)
        at org.apache.maven.plugin.eclipse.EclipsePlugin.writeConfiguration(Ecli
psePlugin.java:1178)
        at org.apache.maven.plugin.ide.AbstractIdeSupportMojo.execute(AbstractId
eSupportMojo.java:511)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:106)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:208)
        ... 19 more
Caused by: java.io.IOException: The filename, directory name, or volume label sy
ntax is incorrect
        at java.io.WinNTFileSystem.canonicalize0(Native Method)
        at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:414)
        at java.io.File.getCanonicalPath(File.java:618)
        at org.apache.maven.plugin.ide.IdeUtils.getCanonicalPath(IdeUtils.java:1
43)
        ... 27 more

像这样的规范化错误指出了使用“$ {basedir}”的pom文件中的一个问题,该问题不是指pom文件,但我没有看到这一点。

关于如何解决此问题的任何想法?这是 Eclipse WTP 的全新安装,并按照说明启动和运行 Apache CXF。没有任何东西是定制的,我只是按照他们告诉我的去做,所以我可以编写一些基本的 Web 服务代码。

4

1 回答 1

0

我不知道您所指的页面。但是,如果您从 CXF 开始,这里有两种从 WSDL 生成 JAXB、服务和客户端类的最简单方法,使用自下而上的方法生成 wsdl 也很容易。

第一种方法

  1. 新建项目 -> 动态项目
  2. 选择您要使用的服务器。
  3. 在配置中选择自定义并选择修改和广告 cxf 和 jaxb 方面。
  4. 单击下一步直到您需要添加 cxf 库(您需要下载)。
  5. 点击完成。
  6. 将您的 wsdl 复制到项目中。
  7. 选择其他并选择网络服务
  8. 选择自上而下的方法并添加选择你的wsdl。
  9. 选择 Web 服务运行时作为 cxf
  10. 剩下的步骤几乎是不言自明的。

其他方式来自maven。

  1. 添加 cxf 依赖项参考(http://cxf.apache.org/docs/using-cxf-with-maven.html可以使用 2.7.6 版本)。
  2. 添加 Spring 依赖项
  3. 添加插件生成jaxb等cxf类,wsdl2java参考( http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html )
  4. 在下面的代码中,我添加了配置文件 code-gen,我运行它以使用目标生成资源生成类。

    代码生成本地

                    <plugin>
                        <groupId>org.eclipse.m2e</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <version>1.0.0</version>
                        <configuration>
                            <lifecycleMappingMetadata>
                                <pluginExecutions>
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>org.apache.cxf</groupId>
                                            <artifactId>cxf-codegen-plugin</artifactId>
                                            <versionRange>[2.7,)</versionRange>
                                            <goals>
                                                <goal>wsdl2java</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <execute />
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMappingMetadata>
                        </configuration>
                    </plugin>
    
                </plugins>
            </pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-codegen-plugin</artifactId>
                    <version>${cxf.version}</version>
                    <executions>
                        <execution>
                            <id>generate-sources</id>
                            <phase>generate-sources</phase>
                            <configuration>
                                <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                                <wsdlOptions>
                                    <wsdlOption>
                                        <wsdl>${basedir}/src/main/resources/wsdl/MyWSDL.wsdl</wsdl>
                                        <wsdlLocation>classpath:wsdl/MyWSDL.wsdl</wsdlLocation>
                                        <extraargs>
                                            <extraarg>-impl</extraarg>
                                            <extraarg>-verbose</extraarg>
                                            <extraarg>-client</extraarg>
                                            <extraarg>-server</extraarg>
                                        </extraargs>
                                    </wsdlOption>
                                </wsdlOptions>
                            </configuration>
                            <goals>
                                <goal>wsdl2java</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
    
            </plugins>
        </build>
    </profile>
    

第一种方法的优点是eclipse甚至生成cxf-bean.xml,而第二种方法不生成beans.xml。所以我更喜欢的是,如果我第一次使用第一种方法生成。如果有任何 wsdl 更改,则在子序列上运行,我运行 maven 方式。

于 2013-10-03T19:50:14.563 回答