How to download dependencies in gradle

前端 未结 8 1338
暗喜
暗喜 2020-11-30 23:00

I have a custom compile task.

task compileSpeedTest(type: JavaCompile) {
    classpath = files(\'build\')
    source = fileTree(\'src/test/java/speed\')
             


        
8条回答
  •  悲&欢浪女
    2020-11-30 23:30

    It is hard to figure out exactly what you are trying to do from the question. I'll take a guess and say that you want to add an extra compile task in addition to those provided out of the box by the java plugin.

    The easiest way to do this is probably to specify a new sourceSet called 'speedTest'. This will generate a configuration called 'speedTest' which you can use to specify your dependencies within a dependencies block. It will also generate a task called compileSpeedTestJava for you.

    For an example, take a look at defining new source sets in the Java plugin documentation

    In general it seems that you have some incorrect assumptions about how dependency management works with Gradle. I would echo the advice of the others to read the 'Dependency Management' chapters of the user guide again :)

提交回复
热议问题