Multiple versions of the same dependency in Maven

前端 未结 6 1991
抹茶落季
抹茶落季 2020-11-29 06:19

Is it possible to declare multiple versions of the same dependency in a Maven repo?

I need these dependencies all at once:

    

        
6条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 06:59

    This is how I got around it. FYI: In my case I was building a RPM.

    I used the maven-dependency-plugin to copy the older dependency that gets ignored to a folder in the build directory and then copied that file to the staging area so that it's included in the RPM.

    Here's the code to copy the older dependency:

      
        org.apache.maven.plugins
        maven-dependency-plugin
        3.1.1
        
          
            copy-dependencies
            prepare-package
            
              copy
            
            
              
                
                  some.package.group.id
                  someartifact-id
                  1.2.3
                  false
                  ${project.build.directory}/older-dependencies
                
              
            
          
        
      
    

    And then later on during the building of my RPM I included this scriptlet in the configuration section of my rpm-maven-plugin. This will copy the file to the staging area for the RPM:

    
      
    
    

提交回复
热议问题