jaxb2-maven-plugin仅生成指定的类

时间:2019-01-22 08:58:55

标签: java maven jaxb

我有一个XSD架构,并且jaxb2-maven-plugin生成了所有类。 现在我只想生成一些类,而不是所有类。

我将插件放在pom.xml的配置文件中,这样,只有切换到正确的配置文件,我才能重新创建类。

<profile>
    <id>Classes creation</id>
    <build>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>jaxb2-maven-plugin</artifactId>
          <version>2.3</version>
          <executions>
              <execution>
                  <goals>
                      <goal>xjc</goal>
                  </goals>
              </execution>
          </executions>
          <configuration>
              <schemaDirectory>${basedir}/src/main/resources/documentazione</schemaDirectory>
              <packageName>com.bsssrl.datafatturapa</packageName>
              <outputDirectory>${basedir}/src/main/java</outputDirectory>
              <clearOutputDir>true</clearOutputDir>
              <addGeneratedAnnotation>true</addGeneratedAnnotation>
              <locale>it</locale>
              <properties>
                <property>
                    <name>javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA</name>
                    <value>http,file</value>
                </property>
              </properties>
              <sources>
                  <source>${basedir}/src/main/resources/documentazione/fatturapa_v1.2.xsd</source>
              </sources>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>

我在某些类中添加了特殊的构造函数(具有某些逻辑)以及许多注释和javadoc。

假设我的类A和构造函数A(p1); A(p1,p2)和类B具有新属性。如何锁定A类以防止自动生成并仅生成B类?

0 个答案:

没有答案
相关问题