动态修改 ant 类路径

发布于 2024-12-19 11:36:20 字数 410 浏览 0 评论 0原文

我想使用依赖于 ant 类路径的解析器 (ssh)。

<resolvers>
...
<ssh ...
...
</resolvers>

使用它,我需要在 ant 类路径中使用 jsch 。 Ant 脚本应该仅依赖于公共库(其中还包括已解析的 jsch 依赖项)- 在任何客户端 PC 上使用它。场景是:

  1. 下载lib的任务。
  2. 提取libs(jsch等)
  3. ivy:configure

但是ivy:configure没有任何classpathref参数,所以我不清楚如何加载我提取的jar。

是否可以?

或者,可能,以某种方式使用扩展类路径在内部再次运行 ant?

I want to use resolvers (ssh) which are dependant on ant classpath.

Something like

<resolvers>
...
<ssh ...
...
</resolvers>

To use it I need jsch in ant classpath. Ant script should depends only on common lib (which also includes resolved jsch dependencies) - to use it on any client PC. Scenario is:

  1. task to download lib.
  2. Extract libs (jsch and etc.)
  3. ivy:configure

But ivy:configure does not have any classpathref param, so it is unclear for me how to load jars I extracted.

Is it possible?

Or, probably, somehow run ant again internally with extended classpath?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拿命拼未来 2024-12-26 11:36:20

好的,
所以我对问题的评论看起来对我来说很好,但最终它不起作用。

我发现的唯一方法(我的意思是工作方式)是使用

  1. Download common-lib (with ) 运行 ant 脚本,其中包括可选 ivy 处理所需的所有 jar-libs
  2. 构造新的类路径并在同一构建文件上运行 exec所需目标:

    <目标名称=“call.task”if=“wrapped.task.name”>
    <路径id=“ant.class.path”>
        <文件集目录=“${tools.lib.dir}”>
            
        
        
    
    
    
        
    
    
    
        
        
        >
        >
    
    
    

Ok,
so my comment to question looked good for me but at the end it did not work.

The only way I found (working way I mean) is to to run ant script with

  1. Download common-lib (with ) which includes all jar-libs required for optional ivy processing
  2. Construct new classpath and run exec on same build file with required target:

    <target name="call.task" if="wrapped.task.name">
    <path id="ant.class.path">
        <fileset dir="${tools.lib.dir}" >
            <include name="*.jar" />
        </fileset>
        <pathelement location="${java.class.path}" />
    </path>
    
    <condition property="append.dest.dir" value="-Ddest.dir=${dest.dir}" else="">
        <isset property="dest.dir"/>
    </condition>
    
    <exec executable="ant" failonerror="true">
        <arg line="-f ivy-build.xml" />
        <arg line='-lib "${toString:ant.class.path}"' />
        <arg value="${wrapped.task.name}" />
        <arg value="${append.dest.dir}" />
    </exec>
    </target>
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文