找不到Maven插件依赖项

vaqhlq81  于 2023-02-21  发布在  Maven
关注(0)|答案(1)|浏览(263)

在使用java 1.8通过调用maven clean install使用maven 3.6.3构建我的项目时,我收到了以下错误:
[ERROR] Failed to execute goal org.wso2.maven:wso2-esb-proxy-plugin:2.1.0:pom-gen (proxy) on project common: Execution proxy of goal org.wso2.maven:wso2-esb-proxy-plugin:2.1.0:pom-gen failed: Unable to load the mojo 'pom-gen' in the plugin 'org.wso2.maven:wso2-esb-proxy-plugin:2.1.0'. A required class is missing: org/wso2/maven/capp/mojo/AbstractPOMGenMojo
我了解到类org/wso2/maven/capp/mojo/AbstractPOMGenMojo包含在org.wso2.maven/org.wso2.maven.capp/2.1.0/org.wso2.maven.capp-2.1.0.jar中。
我的pom片段看起来像:

<parent>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <packaging>pom</packaging>

  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.wso2.maven</groupId>
        <artifactId>wso2-esb-proxy-plugin</artifactId>
        <version>2.1.0</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>proxy</id>
            <phase>process-resources</phase>
            <goals>
              <goal>pom-gen</goal>
            </goals>
            <configuration>
              <artifactLocation>target/capp/classes</artifactLocation>
              <typeList>${artifact.types}</typeList>
            </configuration>
          </execution>
        </executions>
        <configuration />
        <!-- here I can enable dependencies to have it working, i.e.
          <dependencies>
          <dependency>
            <groupId>org.wso2.maven</groupId>
            <artifactId>org.wso2.maven.capp</artifactId>
            <version>2.1.0</version>
          </dependency>
          ...
        -->
      </plugin>
    </plugins>
  </build>

我发现在启用了插件依赖项(在上面pom的代码片段中作为注解)之后,代码似乎正在编译。我检查了本地maven repo中的wso 2-esb-proxy-plugin-2.1.0.pom包含:

<dependency>
    <groupId>org.wso2.maven</groupId>
    <artifactId>org.wso2.maven.capp</artifactId>
</dependency>

为什么我需要把org.wso2.maven.capp明确地作为一个插件的依赖项放在pom中才能让它工作?插件的pom文件已经包含了相同的依赖项(尽管没有版本号),但似乎在这种情况下没有考虑到它。

qacovj5a

qacovj5a1#

您不需要在这里显式地添加依赖项。您的配置中的工件位置似乎是错误的。您可以将其更改为以下位置并给予一下吗?

<plugin>
  <groupId>org.wso2.maven</groupId>
  <artifactId>wso2-esb-proxy-plugin</artifactId>
  <version>2.1.0</version>
  <extensions>true</extensions>
  <executions>
    <execution>
      <id>proxy</id>
      <phase>process-resources</phase>
      <goals>
        <goal>pom-gen</goal>
      </goals>
      <configuration>
        <artifactLocation>.</artifactLocation>
        <typeList>${artifact.types}</typeList>
      </configuration>
    </execution>
  </executions>
  <configuration />
</plugin>

这将在/target/capp/artifacts/proxy-service/PROXY_NAME位置生成另一个pom并执行它,其中包含maven-proxy-plugin,它将下载org.wso2.maven.capp依赖项。

相关问题