5

私はcxfを使い始めたばかりなので、おそらく初心者の間違いです..

私は本 soa ガバナンスの実践に取り組んでおり、サンプル プロジェクトをダウンロードしました。

cxf を使用して wsdl からソースをビルドすると、ソースが Eclipse の「ターゲット」ディレクトリに配置されます。しかし、これらは作成された Java ファイルであり、コンパイラはそれらを認識していないように見えるため、これらのファイルを必要とするアプリケーションのビルドはコンパイラ エラーで失敗します。

「ターゲット」の generated-sources ディレクトリをビルドパスなどに追加する必要がありますか?

どうもありがとう!

編集:完全に混乱しています。ポムはこちら

<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 ビルドとして実行しています。それはソースを生成するようです。しかし、パッケージ全体をどのように構築すればよいのでしょうか? ソースを生成してもコンパイルされない..?どうもありがとう!

編集:更新された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 の実行生成ソースが失敗しました。(org.apache.cxf:cxf-codegen-plugin:2.3.2 :wsdl2java:generate-sources:generate-sources)"

しかし、コマンドラインに移動して mvn org.apache.cxf:cxf-codegen-plugin:wsdl2java を実行すると

その後、BUILD SUCCESSを取得します

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] ------------------------------------------------------------------------
4

2 に答える 2