maven 解析器有问题:无法创建任务或类型解析

maven resolver having issues : failed to create task or type resolve

我正在尝试使用 maven 解析器尝试将我的 ant 项目迁移到 maven 并使用以下解析器标签:

<resolve failOnMissingAttachments="true">
    <dependencies>
        <dependency coords="org.apache.maven:maven-profile:2.0.6" />
        <exclusion artifactId="junit" />
        <exclusion groupId="org.codehaus.plexus" />
    </dependencies>
    <path refid="war.lib.path" classpath="runtime" />
</resolve>

instead of using the following :
<!-- retrieve depending libraries -->
<artifact:dependencies pathId="war.lib.path" useScope="runtime">
    <pom file="pom.xml" />
</artifact:dependencies>

但是我在替换为 Maven ant 解析器任务时遇到以下错误:

Problem: failed to create task or type resolve
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

您缺少重现问题的信息。

但是,通过这种简约的 build.xml 演示,我开始了:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="maven-ant-task-resolver-demo" xmlns:r="antlib:org.apache.maven.resolver.ant">
  
  
  <target name="resolve">
      
      <property name="maven.ant.resolver.version" value="1.3.0"/>
      <property name="maven.ant.resolver.jar.name"
          value="maven-resolver-ant-tasks-${maven.ant.resolver.version}-uber.jar"/>
      
      <get
          src="https://repo1.maven.org/maven2/org/apache/maven/resolver/maven-resolver-ant-tasks/${maven.ant.resolver.version}/${maven.ant.resolver.jar.name}"
          dest="." usetimestamp="true"/>
      
      <taskdef uri="antlib:org.apache.maven.resolver.ant"
          resource="org/apache/maven/resolver/ant/antlib.xml"
          classpath="./${maven.ant.resolver.jar.name}"/>
      
      <r:resolve failOnMissingAttachments="true">
          <dependencies>
              <dependency coords="org.apache.maven:maven-profile:2.0.6" />
              <exclusion artifactId="junit" />
              <exclusion groupId="org.codehaus.plexus" />
          </dependencies>
          <path refid="war.lib.path" classpath="runtime" />
          
      </r:resolve>
      
      
      
  </target>
  
</project>