其他分享
首页 > 其他分享> > pluginManagement的坑

pluginManagement的坑

作者:互联网

想用protobuf-maven-plugin插件,用了<pluginManagement/>标签包裹<plugin/>,就引不进来,去掉就可以引进来。需要研究下。

    <build>
        <pluginManagement>
            <plugins>

                <plugin>
                    <groupId>org.xolstice.maven.plugins</groupId>
                    <artifactId>protobuf-maven-plugin</artifactId>
                    <version>0.6.1</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                                <goal>compile-custom</goal>
                            </goals>
                            <configuration>
                                <pluginParameter>enable_deprecated=true</pluginParameter>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

以上配置,引不进来。

   <build>
        <plugins>

            <plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>0.6.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>compile-custom</goal>
                        </goals>
                        <configuration>
                            <pluginParameter>enable_deprecated=true</pluginParameter>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

去掉<pluginManagement/>标签,仅使用<plugins><plugin/></plugins>,就可以了。

此外,引入插件时,还必须指定版本号,否则版本号会是<unknown>。

标签:compile,插件,protobuf,plugin,版本号,maven,pluginManagement
来源: https://www.cnblogs.com/koushr/p/11938393.html