我需要建立一个Gradle Java项目,其中有两组主要代码源和一组测试代码。本质上:
/src/main //this code is the original code
/src/main-alt //this code is an alternative
/src/test //this test code should be runnable against both
我正在尝试找出如何创建本质上为"build-alt"
的新任务,该任务将构建/src/main-alt
并在src/test
中运行测试。同时运行"build"
只需构建原始的/src/main
,然后在src/test
中运行测试。我只是不知道如何为此更改sourceSet。我可以找到的所有示例都在更改测试的sourceSet。或者,是Kotlin(我正在尝试使用Groovy),还是用于非常老的Gradle版本。我正在使用Gradle 5.6