Maven - Depend on assembled zip

后端 未结 3 969
星月不相逢
星月不相逢 2020-11-30 02:18

I\'m trying to have a Project B pull down (and unpack) a ZIP built by Project A and deployed to a remote repository.

The ZIP is cre

3条回答
  •  庸人自扰
    2020-11-30 02:55

    Welcome to Stack Overflow :).

    You are on the right way. Your real problem is using a zip.

    The following configuration is ok and work great for me. It's an old one (2 years ago), and I'm not sure that match the best practices. But I Know that's working.

    This allow me to share some resources between projects, especially for unit tests.

    Zip Project :

    pom.xml

    com.mycompany
    cfg_dev
    1.1.0
    
    
        
            
                org.apache.maven.plugins
                maven-assembly-plugin
                
                    
                        cfg-main-resources
                        
                            single
                        
                        package
                        
                            
                                /src/main/assembly/resources.xml
                            
                        
                    
                
            
        
    
    

    Assembly descriptor : It will produce this artifact : cfg_dev-1.1.0-resources.zip Please, note that

    1. this is a zip archive
    2. the "classifier" is resources (like assembly name)

      resources zip false src/main/resources

    Main Project :

    pom.xml

    Please, note that

    1. this depends on a zip archive
    2. the dependency "classifier" is resources (like previous assembly name)

      
      
          com.mycompany
          cfg_dev
          ${project.version}
          resources
          zip
          test
      
      
        ....
      
      
        
          
          
              src/test/resources
              true
          
          
          
              ${project.build.directory}/test-resources
              true
          
      
      
      
      
          
              org.apache.maven.plugins
              maven-dependency-plugin
              
                  
                      unpack-cfg-test-resources
                      
                          unpack-dependencies
                      
                      generate-test-resources
                      
                          ${project.build.directory}/test-resources
                          cfg_dev
                          ${project.groupId}
                          true
                          pom
                          test
                      
                  
              
          
        
      

    I hope this is clear and that will help you :)

提交回复
热议问题