我面临着一个相当大的多模块maven项目。我想看看根(父)项目是如何由groupId:artifactId形式的子项目/子项目组成的(可能带有一些标识来反映层次结构。
当然,我可以编写自己的插件来获得此打印输出,但我认为一定会有可用的东西。
发布于 2015-06-18 11:58:39
您好,延迟回答,但我已经在maven库中添加了一个插件:
<dependency>
<groupId>org.qunix</groupId>
<artifactId>structure-maven-plugin</artifactId>
<version>0.0.1</version>
</dependency>要运行这个插件,你需要添加到你的pom中,如下所示:
<build>
<plugins>
<plugin>
<groupId>org.qunix</groupId>
<artifactId>structure-maven-plugin</artifactId>
<version>0.0.1</version>
<inherited>false</inherited>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>
printModules
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>然后输出将如下所示:
[INFO] --- structure-maven-plugin:0.0.1:printModules (default) @ test ---
[INFO]
Project structure (all modules):
test
|
|__ a
|
|__ b
|
|
\__ c
|
|__ d
|
|__ e
|
|__ f如果要打印模块的所有文件,请使用goal:printFolders.:printAll;如果只想打印文件夹,请使用goal<inherited>表示在模块中也不执行插件,<ignore>表示使用正则表达式模式跳过此文件。
编辑:没有版本可以从github拉取:https://github.com/buraksarac/MavenStructurePlugin
发布于 2012-04-19 20:24:54
到目前为止,我还没有遇到过这样的插件,甚至没有听说过。谷歌也不知道这一点,所以你可能不得不编写自己的插件,或者尝试解析mvn dependency:tree,或者仅仅是反应堆的构建顺序,可能会大量使用控制台输出流等等。
发布于 2012-06-20 19:41:59
我认为mvn dependency:tree是一个很好的选择。
你应该试试这个:
mvn dependency:tree -DoutputFile=target/dependencies.txt
cat target/dependencies.txt | awk -F ':' '{print $1":"$2}'这样,您将拥有一个很好的依赖关系树,它带有缩进,但没有范围、版本和类型:)
https://stackoverflow.com/questions/10227589
复制相似问题