Ignore sources jar in Ivy retrieve

后端 未结 5 1140
庸人自扰
庸人自扰 2021-02-13 18:56

I would like to retrieve ONLY the library jar when I make use of a dependency entry in my ivy.xml for Red5 (or any project for that matter). No matter how I have configured it,

5条回答
  •  我在风中等你
    2021-02-13 19:38

    I would advise to not use the "transitive" attribute on the dependency declaration and instead attempt to solve your problem using configurations.

    Configurations in ivy are functionally the same as scopes in Maven, but far more flexible.

    I normally declare at least the following 3 configurations in my code

        
            
            
            
        
    

    Corresponds to 3 groups of dependencies I'll need for any java project.

    The secret is how you map you depdencies to your configurations. If you only want the jar without it's dependencies, then declare it as follows:

    
    

    The local compile configuration mapped to the master scope of the remote Maven module. The master scope in Maven excludes any transitive dependencies.

    If you want the artifact to include it's transitive dependencies then declare the configuration mapping as follows:

    
    

    Working ivy.xml file

    This will download a single jar.

    
    
        
        
            
            
            
            
        
        
            
        
    
    

    Revised settings file

    I would also recommend using the ibiblio resolver, which is designed to understand the Maven 1 and Maven 2 repository formats:

    
        
        
            
                
                 ..
                 ..
            
        
    
    

    Note I'm using the Springsource Maven repository, which is more likely to be up-to-date. I don't know if they maintain the old ivy repositories properly or not anymore.

提交回复
热议问题