3

I would like to generate schema from JAXB annotated classes. For this, I am using jaxb2-maven-plugin. The plugin by default scans src/main/java folder for included sources. I would like to specify an extra folder to scan for java classes which is not maven source path.

Can anyone please help?

  <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>${maven.plugin.jaxb2}</version>
        <executions>
           <execution>
              <id>schemagen</id>
              <goals>
                 <goal>schemagen</goal>
              </goals>
              <phase>process-classes</phase>
              <configuration>

                 <includes>
                    <include>SomeFolderWhichIsNotInMavenSourcePath/*.java</include>
                 </includes>
                 <outputDirectory>${project.build.directory}/schemas</outputDirectory>
              </configuration>
           </execution>
        </executions>
     </plugin> 
4

2 に答える 2

0

includesの代わりにsourcesを使用する必要があります。

<sources>
   <source>${basedir}/src/main/java/<YourPath></source>
</sources>

このようにして、ソース タグ間に記述したパスのみをスキャンします。

于 2018-09-13T15:29:52.467 に答える