5
我有maven-jaxb2插件。我生成jaxb對象並將其引用到其他類的項目中。我已將jaxb插件和編譯器插件放在pluginManagement標記下。 Maven首先執行的是編譯階段,而不是生成階段,就好像我刪除了pluginManagement標記,它工作正常,首先生成階段被執行,所有jaxb對象被生成,然後編譯階段被執行。由於pluginManagement標籤,我的項目不能編譯。 pluginManagement標記僅用於定義父pom中的所有插件,以便子pom可以引用這些插件嗎?我的項目不是多模塊項目。如果插件在插件管理下定義,maven目標無法正確執行
<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>