2016-11-25 16 views
0

私はMaven依存関係からxsdファイルをコピーし、それをターゲットフォルダに入れてみましょう。私のプロジェクトのxsdファイルとそれ以降はjaxbクラスを生成したいのですが同じ時間にそれらを生成することはできません。 依存関係のxsdファイルのコードだけを作成すると、jaxbクラスが生成されますが、私のプロジェクトのxsdファイルでは作成できません。Maven Jaxbプラグインはターゲットフォルダからクラスを生成できません

<plugin> 
    <!-- copy the xsdl files of my current project into the target folder--> 
      <artifactId>maven-resources-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>copy-resources-xsd</id> 
        <phase>generate-resources</phase> 
        <goals> 
         <goal>copy-resources</goal> 
        </goals> 
        <configuration> 
         <outputDirectory>${basedir}/target/tmp/schemas</outputDirectory> 
         <encoding>UTF-8</encoding> 
         <resources> 
          <resource> 
           <directory>${basedir}/src/main/schemas</directory> 
           <includes> 
            <include>**/*.xsd</include> 
           </includes> 
          </resource> 
         </resources> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    <!--copy the xsd files of the dependency into the target folder of my current project--> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>copy-libraries</id> 
        <phase>generate-resources</phase> 
        <goals> 
         <goal>copy</goal> 
        </goals> 
        <configuration> 
         <artifactItems> 
          <artifactItem> 
           <groupId>com.my.dependency</groupId> 
           <artifactId>res-communes</artifactId> 
           <version>${res-communes.version}</version> 
           <type>xsd</type> 
           <classifier>typesFy</classifier> 
           <destFileName>typesFy.xsd</destFileName> 
           <outputDirectory>${project.build.directory}/tmp/schemas</outputDirectory> 
          </artifactItem> 
         </artifactItems> 
         <overWriteReleases>false</overWriteReleases> 
         <overWriteSnapshots>true</overWriteSnapshots> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.jvnet.jaxb2.maven2</groupId> 
      <artifactId>maven-jaxb2-plugin</artifactId> 
      <version>${maven-jaxb2-plugin.version}</version> 
      <dependencies> 
       <dependency> 
        <groupId>com.fasterxml.jackson.core</groupId> 
        <artifactId>jackson-annotations</artifactId> 
        <version>${jackson.version}</version> 
       </dependency> 
      </dependencies> 
      <executions> 
       <execution> 
        <goals> 
         <goal>generate</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <extension>true</extension> 
       <enableIntrospection>true</enableIntrospection> 
       <markGenerated>true</markGenerated> 
       <schemas> 
        <schema> 
         <fileset> 
          <directory>${project.build.directory}/tmp/schemas</directory> 
         </fileset> 
        </schema> 
       </schemas> 
       <args> 
        <arg>-Xts:style:org.apache.commons.lang.builder.ToStringStyle.MULTI_LINE_STYLE</arg> 
        <arg>-Xbg</arg> 
        <arg>-Xfluent-api</arg> 
        <arg>-Xinheritance</arg> 
        <arg>-Xannotate</arg> 
        <arg>-XJsr303Annotations</arg> 
       </args> 
       <plugins> 
        <plugin> 
         <groupId>org.jvnet.jaxb2_commons</groupId> 
         <artifactId>jaxb2-basics</artifactId> 
         <version>${jaxb2-basics.version}</version> 
        </plugin> 
        <plugin> 
         <groupId>org.jvnet.jaxb2_commons</groupId> 
         <artifactId>jaxb2-basics-annotate</artifactId> 
         <version>${jaxb2-basics-annotate.version}</version> 
        </plugin> 
        <plugin> 
         <groupId>org.apache.cxf.xjcplugins</groupId> 
         <artifactId>cxf-xjc-ts</artifactId> 
         <version>${cxf-xjc-ts.version}</version> 
        </plugin> 
        <plugin> 
         <groupId>org.apache.cxf.xjcplugins</groupId> 
         <artifactId>cxf-xjc-boolean</artifactId> 
         <version>${cxf-xjc-boolean.version}</version> 
        </plugin> 
        <plugin> 
         <groupId>org.jvnet.jaxb2_commons</groupId> 
         <artifactId>jaxb2-fluent-api</artifactId> 
         <version>${jaxb2-fluent-api.version}</version> 
        </plugin> 
        <plugin> 
         <groupId>com.github.krasa</groupId> 
         <artifactId>krasa-jaxb-tools</artifactId> 
         <version>${krasa-jaxb-tools.version}</version> 
        </plugin> 
       </plugins> 
      </configuration> 
     </plugin> 

答えて

1

maven-jaxb2-pluginは、デフォルトではgenerate-sourcesで実行されます。スキーマをgenerate-resourcesに解凍します。あなたがそれらをコンパイルしようとすると、スキーマはまだそこにはありません。

このような問題をデバッグするには、mvn -X clean installを実行してログを確認してください。

関連する問題