Skip to content

The developmentOnly configuration only works for devtools #305

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

Closed
hemeroc opened this issue Oct 19, 2019 · 3 comments
Closed

The developmentOnly configuration only works for devtools #305

hemeroc opened this issue Oct 19, 2019 · 3 comments

Comments

@hemeroc
Copy link

hemeroc commented Oct 19, 2019

Setup:

  • ceate a new project
    • gradle, kotlin, 2.2.x
    • devTools and actuator dependencies
  • set the actuator dependency from implementation to developmentOnly
  • run ./gradlew clean build

Expected behaviour:

  • devtools is not packaged within the jar
  • actuator is not packaged within the jar

Current behaviour:

  • devtools is not packaged within the jar
  • actuator is packaged within the jar
$ jar tf build/libs/demo-0.0.1-SNAPSHOT.jar | grep -E "actuator|devtools"
BOOT-INF/lib/spring-boot-starter-actuator-2.2.0.RELEASE.jar
BOOT-INF/lib/spring-boot-actuator-autoconfigure-2.2.0.RELEASE.jar
BOOT-INF/lib/spring-boot-actuator-2.2.0.RELEASE.jar

Either I'm doing something completely wrong or there is a bug in the jar packaging or the behaviour is intended but then the name is misleading.

@wilkinsona
Copy link
Contributor

wilkinsona commented Oct 19, 2019

It's development only in that it's on the classpath while you're developing and running your application, but it not on the classpath while you're testing your classpath. It's the bootJar task, via its excludeDevtools property (which defaults to true) that prevents the DevTools jar from being packaged in BOOT-INF/lib.

The name developmentOnly isn't perfect, but we've been unable to think of a better, reasonably concise name. If you'd like to suggest something we'd be more than happy to consider it.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Oct 19, 2019
@hemeroc
Copy link
Author

hemeroc commented Oct 22, 2019

Ok, now that makes a lot more sense. Thanks for clarification.
In my project I now excluded all developmentOnly dependencies with following code snippet:

tasks.withType<BootJar> {
    exclude { developmentOnly.resolvedConfiguration.files.contains(it.file) }
}

@hemeroc hemeroc closed this as completed Oct 22, 2019
@wilkinsona
Copy link
Contributor

Thanks for following up. You may be interested in this Spring Boot issue. Once implemented, it should take care of all of this for you.

@wilkinsona wilkinsona removed the status: waiting-for-feedback We need additional information before we can continue label Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants