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

Gradle plugin fails with multiple JavaExec tasks in the build #721

Closed
szpak opened this Issue Apr 23, 2014 · 5 comments

Comments

Projects
None yet
4 participants
@szpak
Contributor

szpak commented Apr 23, 2014

Working on an issue in gradle-pitest-plugin I spotted that spring-boot-gradle-plugin doesn't work well with multiple JavaExec tasks available in the build.

There are a few issues:

  1. RunApp task takes all JavaExec and try to execute them. There could be some other JavaExec tasks like pitest tasks which executes PIT as a separate JVM process instead of the desired run task. It is not desired to run them as well.
  2. SpringBootPlugin checks on apply if there is any JavaExec task and only if not adds ApplicationPlugin. Having applied also pitest plugin earlier (or any other plugin with JavaExec task which doesn't run the Main application) results in the fact the ApplicationPlugin is not applied (and not available).
  3. enhanceRunTasks from SpringBootPlugin enhances only tasks that are added after the spring-boot plugin. This can generate problems if ApplicationPlugin was applied earlier.
  4. enhanceRunTasks enhances all JavaExec and RunApp tasks. This can break those tasks (like pitest task).

There is a small application created by @lando which reproduces mentioned problems.

I don't know what was the reason (the use cases) to support multiple JavaExec tasks and I'm not sure what would be best to resolve this situation. I have experience only with one Spring Boot project, but maybe in most cases there is an assumption that spring-boot plugin will create and configure ApplicationPlugin plugin (which would work by default). In case of other JavaExec tasks there could be checked the task name. One existing JavaExec task with the name "run" (from ApplicationPlugin) should be accepted. In other cases there should be reported an error listing existing JavaExec tasks (with their names) and the information that task(s) to be enhanced (and run on bootRun) should be explicit configured (by name?) in spring-boot configuration closure. This would (probably) fix issues 1,2,4. Issue 3 could be probably fixed by the move the tasks enhancements to project.afterEvaluate phase when all tasks are known and selected can be enhanced (needs to be verified in practice).

What do you think about that?

@szpak szpak referenced this issue Apr 23, 2014

Closed

JDK-8 support #7

szpak added a commit to szpak/gradle-pitest-plugin that referenced this issue Apr 23, 2014

Add problem with spring-boot applications to FAQ
Versions 0.33.0+ don't work properly with spring-boot-gradle-plugin
spring-projects/spring-boot#721

@dsyer dsyer added this to the 1.1.0 milestone Apr 24, 2014

@dsyer dsyer added the enhancement label Apr 24, 2014

@dsyer

This comment has been minimized.

Show comment
Hide comment
@dsyer

dsyer Apr 24, 2014

Member

All that sounds very sensible, as long as it basically preserves the existing behaviour for "simple" projects with no explicit run exec tasks. Would you like to submit a pull request (see link in README for contributor's agreement)?

Member

dsyer commented Apr 24, 2014

All that sounds very sensible, as long as it basically preserves the existing behaviour for "simple" projects with no explicit run exec tasks. Would you like to submit a pull request (see link in README for contributor's agreement)?

@szpak

This comment has been minimized.

Show comment
Hide comment
@szpak

szpak Apr 26, 2014

Contributor

I will try to make required modifications, but probably not until May. When do you plan to release 1.0.3?

Contributor

szpak commented Apr 26, 2014

I will try to make required modifications, but probably not until May. When do you plan to release 1.0.3?

@philwebb philwebb modified the milestones: 1.1.0.M2, 1.1.0.M1 May 7, 2014

@philwebb

This comment has been minimized.

Show comment
Hide comment
@philwebb

philwebb May 26, 2014

Member

I think 794808b should have fixed this, please give the latest 1.1.0 SNAPSHOT a go.

Member

philwebb commented May 26, 2014

I think 794808b should have fixed this, please give the latest 1.1.0 SNAPSHOT a go.

@philwebb philwebb closed this May 26, 2014

@szpak

This comment has been minimized.

Show comment
Hide comment
@szpak

szpak May 30, 2014

Contributor

Thanks Phil. The problem is not reproducible with the sample application and 1.1.0.M2. @holgerstolzenberg, could you check it with your production system?

Contributor

szpak commented May 30, 2014

Thanks Phil. The problem is not reproducible with the sample application and 1.1.0.M2. @holgerstolzenberg, could you check it with your production system?

@holgerstolzenberg

This comment has been minimized.

Show comment
Hide comment
@holgerstolzenberg

holgerstolzenberg Jun 2, 2014

I just upgraded to 1.1.0.RC1. It seems the issue is fixed. I can run pitest and bootRun tasks successfully. With the bootRun there was another issue with the ASM but it seems related to spring-loaded. Removed spring-loaded from buildscript dependencies and everything works fine. So I think this can be closed.

@szpak You may want to release 0.33.0-SNAPSHOT now :-)

I just upgraded to 1.1.0.RC1. It seems the issue is fixed. I can run pitest and bootRun tasks successfully. With the bootRun there was another issue with the ASM but it seems related to spring-loaded. Removed spring-loaded from buildscript dependencies and everything works fine. So I think this can be closed.

@szpak You may want to release 0.33.0-SNAPSHOT now :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment