For a big project with multimodules based on Gradle, lets say Spring Security
.
I am able to build a specific module (and skipping some tasks to gain time) through:
./gradlew :spring-security-config:build
./gradlew :spring-security-config:build -x test
./gradlew :spring-security-config:build -x javadoc -x test
Assuming the following scenario:
module-x
src/main/java
com.something.abc
A1.java
A2.java
...
AN.java
com.something.xyz
B1.java
B2.java
...
BN.java
Assuming that only one java file was edited. Lets say A7.java
. How I can compile/build only for that file?, because with:
./gradlew :module-x:build -x test
“Seems” that all the module is compiled again, it because it always takes the same time, I thought that Gradle has an internal cache to know what was changed and what classes weren’t changed, therefore it should be faster. Even if that module has for example 100 classes and only 4 were changed (same or different packages) I though the build should be faster than the first time where there are no compiled classes, or clean
task was executed.
Now, about testing I can execute a specific Test through:
./gradlew :spring-security-xxx:test --tests org.springframework.security.something.XTests
From above, I know is possible apply for a specific package too.
Therefore if is possible, how build/compile a:
- specific class
- specific package