2

Java でプラグイン構成を読み取る必要があります。実行時の依存関係、コンパイル時の依存関係などを取得するために aether ライブラリを使用しましたが、pom ファイルに基づいてプラグイン構成を読み取るために aether を使用できますか?

このようなもの

<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);
4

1 に答える 1