Gradle: retrieve only one of multiple published artifacts?

前端 未结 2 469
隐瞒了意图╮
隐瞒了意图╮ 2021-01-21 06:46

I\'ve got an Ivy repository with multiple published artifacts, something like this:

/mygroup/mymodule/1.1.1/mymodule-1.1.1.jar
/mygroup/mymodule/1.1.1/mymodule-c         


        
2条回答
  •  攒了一身酷
    2021-01-21 07:28

    The Ivy module descriptor doesn't assign the artifacts to different configurations, hence it's not possible to retrieve them independently. If all you want is to only put one of the two artifacts on the compile class path, something like the following should work:

    configurations {
        mymodule
    }
    
    dependencies {
        mymodule 'mygroup:mymodule:1.1.1'
        compile configurations.mymodule.filter { it.name == 'mymodule-client-1.1.1.jar' } 
    }
    

提交回复
热议问题