Possible to get one of dependency version to insert into a filtered resource file?

前端 未结 1 957
小蘑菇
小蘑菇 2021-01-28 14:55

I\'ve a resource file, that is filtered by maven:

version=${project.version}
buildDate=${timestampFormatted}
buildBy=${user.name}   
fileEncoding=${file.encoding         


        
相关标签:
1条回答
  • 2021-01-28 15:36

    First extract desired dependencies' versions into a property (which is always a good idea):

    <properties>
        <org.springframework.version>3.1.0.RC2</org.springframework.version>
    </properties>
    

    And use it later in pom.xml:

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    

    Once this is done you can reference the property in filtered resource:

    XX_LIB_VERSION=${org.springframework.version}
    
    0 讨论(0)
提交回复
热议问题