当前位置: 首页 > 知识库问答 >
问题:

cxf将源文件放入目标,但编译器看不到它们?

章承
2023-03-14

我刚刚开始使用cxf,所以这可能是新手的错误…

我正在阅读《soa governance in action》一书,并下载了示例项目。

多谢!

编辑:彻底搞糊涂了。这是pom

<build>
    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings 
                only. It has no influence on the Maven build itself. -->
            <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>
                                        build-helper-maven-plugin
                                </artifactId>
                                    <versionRange>[1.7,)</versionRange>
                                    <goals>
                                        <goal>add-source</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute></execute>
                                </action>
                            </pluginExecution>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.cxf</groupId>
                                    <artifactId>
                                        cxf-codegen-plugin
                                </artifactId>
                                    <versionRange>[1.0,)</versionRange>
                                    <goals>
                                        <goal>wsdl2java</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute></execute>
                                </action>
                            </pluginExecution>

                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>target/generated/cxf</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <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/contract/accountService.wsdl</wsdl>
                            </wsdlOption>
                        </wsdlOptions>
                    </configuration>
                    <goals>
                        <goal>wsdl2java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxrs</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http-jetty</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.manning.ossoagov.chapter2</groupId>
        <artifactId>traffic-service-general</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
</dependencies>

编辑:我也不清楚我应该如何建立它…?我正在eclipse中作为maven构建运行它,目标是Generate-Sources。似乎产生了源。但我该如何构建整个软件包呢?即使生成了源代码,它也不会编译。?多谢!

编辑:更新的Maven日志

 [INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.manning.ossoagov.chapter2:traffic-service-remoting-WS:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.apache.cxf:cxf-rt-frontend-jaxws:jar -> duplicate declaration of version ${cxf.version} @ line 134, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Traffic Service WS Remoting 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- cxf-codegen-plugin:2.3.2:wsdl2java (generate-sources) @ traffic-service-remoting-WS ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:add-source (add-source) @ traffic-service-remoting-WS ---
[INFO] Source directory: /Users/bw/Documents/workspace3/traffic-service-remoting-WS/target/generated/cxf added.
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ traffic-service-remoting-WS ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ traffic-service-remoting-WS ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ traffic-service-remoting-WS ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!    [INFO] Copying 1 resource
[INFO]    [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ traffic-service-remoting-WS ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.7.1:test (default-test) @ traffic-service-remoting-WS ---
[INFO] Surefire report directory: /Users/bw/Documents/workspace3/traffic-service-remoting-WS/target/surefire-reports
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ traffic-service-remoting-WS ---
[INFO] Building jar: /Users/bw/Documents/workspace3/traffic-service-remoting-WS/target/traffic-service-remoting-WS-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ traffic-service-remoting-WS ---
[INFO] Installing /Users/bw/Documents/workspace3/traffic-service-remoting-WS/target/traffic-service-remoting-WS-0.0.1-SNAPSHOT.jar to /Users/bw/.m2/repository/org/manning/ossoagov/chapter2/traffic-service-remoting-WS/0.0.1-SNAPSHOT/traffic-service-remoting-WS-0.0.1-SNAPSHOT.jar
[INFO] Installing /Users/bw/Documents/workspace3/traffic-service-remoting-WS/pom.xml to /Users/bw/.m2/repository/org/manning/ossoagov/chapter2/traffic-service-remoting-WS/0.0.1-SNAPSHOT/traffic-service-remoting-WS-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.179s
[INFO] Finished at: Tue Apr 16 07:49:17 BST 2013
[INFO] Final Memory: 11M/81M
[INFO] ------------------------------------------------------------------------

编辑:试图缩小范围。我有一个“Maven问题”,“目标org.apache.cxf:cxf-codegen-plugin:2.3.2:wsdl2java的执行generate-sources失败。(org.apache.cxf:cxf-codegen-plugin:2.3.2:wsdl2java:generate-sources:generate-sources)”

但如果我转到命令行并执行mvn org.apache.cxf:cxf-codegen-plugin:wsdl2java

有没有可能eclipse的自动构建没有以相同的方式运行它?会不会是警告..?

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.manning.ossoagov.chapter2:traffic-service-remoting-WS:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.apache.cxf:cxf-rt-frontend-jaxws:jar -> duplicate declaration of version ${cxf.version} @ line 134, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]                                                                     
[INFO] ------------------------------------------------------------------------
[INFO] Building Traffic Service WS Remoting 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- cxf-codegen-plugin:2.3.2:wsdl2java (default-cli) @ traffic-service-remoting-WS ---
[INFO] Nothing to generate
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.868s
[INFO] Finished at: Tue Apr 16 09:37:40 BST 2013
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------

共有1个答案

商业
2023-03-14

您应该将这个文件夹添加到类路径中,使用maven您可以这样做:

      <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.4</version>
            <executions>
                <execution>
                    <id>add-wsdl-source</id>
                    <phase>process-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>${project.build.directory}/path/to/generated/sources</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
 类似资料:
  • 我已经搜索了所有关于为什么我们应该有不同于目标的来源,但不一致的答案: 如果JDK向下兼容,为什么在1.7上编译时需要将目标设置为1.8? 将源设置为高于目标将不起作用,例如错误: 源版本8需要目标版本1.8 同样来自Maven: 仅仅设置target选项并不能保证代码在具有指定版本的JRE上实际运行。陷阱在于无意中使用了只存在于后来的JRE中的API,这会导致代码在运行时出现链接错误 有人能举个

  • 本文向大家介绍Linux下将源文件编译成目标文件的过程解析,包括了Linux下将源文件编译成目标文件的过程解析的使用技巧和注意事项,需要的朋友参考一下 简介 请讲一下linux如何源文件逐步编译成可执行文件。 解答 首先先上图对编译的整个过程有个感性的认识,然后再逐步分析各个过程。 以hello.c 程序为例 一个.c源程序需要经过预处理器生成.i文件,再经过编译器生成.s文件,再经过汇编器生成可

  • 我试图在Android Studio中导入一个项目,该项目最初是要用Android-19 API编译的。然而,现在我需要让它在Android4.0.3的设备上工作(所以我想用android-15编译)。然而,Android Studio一直告诉我这一点,不管我做什么: (幸运的是我没有安装android-19,否则我根本不会注意到,对吧?) 我尝试了stackoverflow和其他站点中提出的解决

  • 我在maven-compiler-plugin的pom.xml中有以下配置。 JDK的源版本和目标版本应该是什么?它如何依赖于安装在我的计算机上的jdk版本?他们可能不一样吗?例如,安装的jdk是1.8,在源参数-1.6,目标-1.7中。

  • 问题内容: 如今,我们可以将文件拖放到一个特殊的容器中,并使用XHR2上载它们。带有实时进度条等。非常酷的东西。 但是有时候我们不想要那么酷。我想要的是一次将文件拖放 到标准HTML文件输入中 :。 那可能吗?有什么方法可以从文件拖放中用正确的文件名(?)“填充”文件输入吗?(出于文件系统安全性原因,完整的文件路径不可用。) 为什么? 因为我想提交一份普通表格。适用于所有浏览器和所有设备。拖放只是

  • 编译可调试的目标文件 为了使得编译出来的代码是能够被gdb这样的调试器调试,我们需要在使用gcc编译源文件的时候添加参数:"-g"。这样编译出来的目标文件中才会包含可以用于调试器进行调试的相关符号信息。