我需要阅读 Java 中的插件配置。我已经使用 aether 库来获取运行时依赖项、编译时依赖项等。但是我可以使用 aether 来读取基于 pom 文件的插件配置吗?
像这样的东西
<properties>
<servicePort>8080</servicePort>
<adminPort>8081</adminPort>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.company.group</groupId>
<artifactId>my-plugin</artifactId>
<version>0.1-SNAPSHOT</version>
<configuration>
<myConfig>
<somePropName>someProp</somePropName>
<portMappings>
<someProp>${servicePort}</someProp>
<someProp-admin>${adminPort}</someProp-admin>
</portMappings>
</myConfig>
</configuration>
</plugin>
</plugins>
</build>
我希望能够解决
some-Prop 8080
some-prop-admin 8081
从这个机制
目前我像这样获取编译关系依赖项
Dependency dependency = new Dependency(new DefaultArtifact(
coordinate), COMPILE);
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(dependency);
collectRequest.addRepository(this.aetherSession
.getRemoteRepository());
DependencyNode node = this.aetherSession
.getRepoSystem()
.collectDependencies(this.aetherSession.getRepoSession(),
collectRequest).getRoot();
DependencyRequest dependencyRequest = new DependencyRequest();
dependencyRequest.setRoot(node);
result = this.aetherSession
.getRepoSystem()
.resolveDependencies(this.aetherSession.getRepoSession(),
dependencyRequest).getArtifactResults();
FinalResult.addAll(result);