question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update Gradle plugin to skip processAot when there is no main source and to skip processTestAot when there is no test source

See original GitHub issue

@sdeleuze pointed out that https://github.com/mhalbritter/spring-aot-jarsigner-reproducer fails with the following.

> Task :app:processTestAot FAILED
Error: Could not find or load main class org.springframework.test.context.aot.TestAotProcessor
Caused by: java.lang.ClassNotFoundException: org.springframework.test.context.aot.TestAotProcessor

The app project does not have a dependency on spring-test (or spring-boot-starter-test). So that explains why org.springframework.test.context.aot.TestAotProcessor cannot be found.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
wilkinsonacommented, Sep 20, 2022

Thanks, Sam. Skipping processAot when the main source set hasn’t output anything and processTestAot when the test source set hasn’t output anything sounds like a good idea to me.

0reactions
sbrannencommented, Sep 20, 2022

The example project does not include any tests.

./gradlew build -x test succeeds.

./gradlew build fails with the aforementioned error.

./gradlew build -x processTestAot succeeds.

Thus, the issue is that processTestAot runs automatically even if there are no tests, and IMO that’s what we should fix.

Attempting to build a project that does not include tests should not fail when trying to process non-existent tests for AOT.

The Native Build Tools project ran into similar issues where users complained about native tests failing when the project didn’t contain any tests.

As Stéphane pointed out, this can be particularly cumbersome in multi-module projects (both for Gradle and Maven): some modules may contain tests while others do not.

Related Issues

Summary

I think processAot should probably fail with an informative message if the required dependencies are missing.

I think processTestAot should not run at all if there are no tests. If there are tests and required dependencies are missing, processTestAot should fail with an informative message.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Gradle Skip Test - Stack Overflow
Due to official user guide, there are 3 ways to skip some task in gradle. The first 2, are: using predicate and exception...
Read more >
Spring Boot Gradle Plugin Reference Guide
It allows you to package executable jar or war archives, run Spring Boot applications, and use the dependency management provided by spring-boot ...
Read more >
Skipping Tests With Gradle - Baeldung
In this short tutorial, we'll see how to skip tests when using the Gradle build tool.
Read more >
Upgrading your build from Gradle 7.x to the latest
The kotlin-gradle-plugin version 1.7.10 changes the type hierarchy of the KotlinCompile task type. It doesn't extend from AbstractCompile anymore.
Read more >
Configure your build - Android Developers
The Android build system compiles app resources and source code and ... notes to learn how to update Gradle and the Android Gradle...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found