Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider running assemble instead of -x test build by default #55

Closed
jonatan-ivanov opened this issue Mar 7, 2021 · 2 comments · Fixed by #65
Closed

Consider running assemble instead of -x test build by default #55

jonatan-ivanov opened this issue Mar 7, 2021 · 2 comments · Fixed by #65
Assignees
Labels
type:enhancement A general enhancement

Comments

@jonatan-ivanov
Copy link

The default value of BP_GRADLE_BUILD_ARGUMENTS currently is --no-daemon -x test build. This does not seem a good practice to me, let me quote from the documentation of the Gradle Java Plugin and give more details:

  • test: Runs the unit tests using JUnit or TestNG.
  • check Depends on: test
    Aggregate task that performs verification tasks, such as running the tests. Some plugins add their own verification tasks to check. You should also attach any custom Test tasks to this lifecycle task if you want them to execute for a full build. This task is added by the Base Plugin.
  • assemble Depends on: jar, and all other tasks that create artifacts attached to the archives configuration
    Aggregate task that assembles all the archives in the project. This task is added by the Base Plugin.
  • build Depends on: check, assemble
    Aggregate tasks that performs a full build of the project. This task is added by the Base Plugin.

See the task graph of the build task
task graph

Based on this, running -x test build has the following effects:

  • assemble creates the necessary artifacts for the image
  • test task is excluded, this means no unit tests
  • check is not excluded, this means that every other type of tests and checks will be executed: functional tests, integration tests, performance tests, checkstyle, pmd, spotbugs, spotless, code coverage (e.g.: jacoco), etc
  • build is not excluded, every other task that is hooked-up to build will be executed

I think this is not a good user experience and not a good example for the users. Since to me it seems having the right defaults is very important for paketo-buildpacks, I think based on the documentation, and based on the common practice, the right task to produce the necessary artifacts should be assemble so the default value of BP_GRADLE_BUILD_ARGUMENTS should be assemble --no-daemon.

@jonatan-ivanov jonatan-ivanov changed the title Consider runnning assemble instead of -x test build Consider running assemble instead of -x test build by default Mar 7, 2021
@stigkj
Copy link
Contributor

stigkj commented Mar 16, 2021

Examples of tasks that will run (unnecessarily) when using -x test build as the default:

  • All linting type tasks like
    • Checkstyle
    • PMD
    • Findbugs
  • All other test tasks
    • Component tests
    • Tests of other languages, like running npm run jest for javascript tests

@dmikusa dmikusa self-assigned this Apr 13, 2021
@dmikusa dmikusa added the type:enhancement A general enhancement label Apr 13, 2021
@dmikusa
Copy link
Contributor

dmikusa commented Apr 14, 2021

Thanks for raising up this issue. +1 for making this change. It seems to bring the behavior more in line with the intent, which is to build the artifact and not run tests. I think it also puts this buildpack more in line with the Maven buildpack's behavior, which I also think is a good thing.

I should be able to get this fixed up shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement A general enhancement
Projects
None yet
3 participants