1

我正在尝试按名称检索 maven-dependecy-plugin 中的工件项作为属性,以将其值写入我的战争清单文件中。我需要类似的东西${project.artifactItems["name"].value}来检索我的值,而不必以编程方式将每个 jar 清单文件作为流读取。

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
  <execution>
    <id>copy-installed</id>
    <phase>test</phase>
    <goals>
      <goal>copy</goal>
    </goals>
    <configuration>
      <artifactItems>
        <artifactItem>
          <groupId>${project.groupId}</groupId>
          <artifactId>prj-applet</artifactId>
          <version>${test.project.version}</version>
          <type>jar</type>
        </artifactItem>
        <artifactItem>
          <groupId>${project.groupId}</groupId>
          <artifactId>prj-pdf-render-applet</artifactId>
          <classifier>jar-with-dependencies</classifier>
          <version>${test.project.version}</version>
          <type>jar</type>
        </artifactItem>
      </artifactItems>

我需要使用 war 插件在我的清单文件中插入每个检索到的值:

<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>test</warName>
  <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
   <!-- <warName>test</warName> -->
  <failOnMissingWebXml>false</failOnMissingWebXml>
  <archive>
    <manifestEntries>

      <applicationVersion>${pom.version}</applicationVersion>
      <applicationBuildTimestamp>${maven.build.timestamp}</applicationBuildTimestamp>
    </manifestEntries>
  </archive>
</configuration>
4

1 回答 1

1

假设你有这个依赖

<dependency>
    <groupId>some-groupid</groupId>
    <artifactId>some-artifactid</artifactId>
    <type>jar</type>
</dependency>

你可以通过 ${maven.dependency.some-groupid.some-artifactid.jar.path} 获得你的依赖

于 2013-04-26T10:08:28.070 回答