我有 maven-jaxb2-plugin。我生成 jaxb 对象并将其引用到其他项目类中。我已将 jaxb 插件和编译器插件放在 pluginManagement 标记下。Maven首先执行编译阶段而不是生成阶段,就像我删除pluginManagement标记一样,它工作正常,首先执行生成阶段并生成所有jaxb对象,然后执行编译阶段。由于 pluginManagement 标记,我的项目无法编译。pluginManagement 标签是否仅用于定义父 pom 中的所有插件,以便子 pom 可以引用这些插件?我的项目不是多模块项目。
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${basedir}/src/main/resources/schema</schemaDirectory>
<generatePackage>com.common.dto</generatePackage>
<schemaIncludes>
<include>*.xsd</include>
</schemaIncludes>
<removeOldOutput>false</removeOldOutput>
<strict>false</strict>
<verbose>true</verbose>
<forceRegenerate>true</forceRegenerate>
<extension>true</extension>
</configuration>
</plugin>
</plugins>
</pluginManagement>