Can I use properties in an ivy.xml file to avoid repeating version numbers of dependencies?

后端 未结 3 1136
面向向阳花
面向向阳花 2021-02-02 12:06

Here\'s what part of my ivy.xml looks like right now:


&l         


        
相关标签:
3条回答
  • 2021-02-02 12:10

    Syntax is correct. All you need to do is set the ANT property somewhere.

    For example

    ant -Dspring.version=3.0.2.RELEASE
    

    Another alternative is to add the property declaration into the ivysettings.xml file

    <ivysettings>
    
        <property name="spring.version" value="3.0.2.RELEASE"/>
    
        <settings defaultResolver="maven2"/>
        <resolvers>
            <ibiblio name="maven2" m2compatible="true"/>
        </resolvers>
    </ivysettings>
    
    0 讨论(0)
  • 2021-02-02 12:27

    I ended up using XML entities to do the substitution. This keeps everything in the same file, which is important for my use case.

    <?xml version="1.0"?>
    <!DOCTYPE ivy-module [
        <!ENTITY spring.version "3.0.2.RELEASE">
    ]>
    <ivy-module version="2.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd">
    
        <info organisation="org" module="mod"/>
    
        <dependencies>
            <dependency org="org.springframework" name="org.springframework.core" rev="&spring.version;" />
            <dependency org="org.springframework" name="org.springframework.context" rev="&spring.version;" />
            <dependency org="org.springframework" name="org.springframework.jdbc" rev="&spring.version;" />
            <dependency org="org.springframework" name="org.springframework.beans" rev="&spring.version;" />
            <dependency org="org.springframework" name="org.springframework.jms" rev="&spring.version;" />
        </dependencies>
    </ivy-module>
    
    0 讨论(0)
  • 2021-02-02 12:36

    You can use property files as explained here: http://apache-ivy.996301.n3.nabble.com/ivyde-properties-on-ivy-xml-td7484.html

    <properties file="${ivy.project.dir}/build.properties" />
    

    insite ivysettings.xml

    0 讨论(0)
提交回复
热议问题