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

spring-boot-maven-plugin:2.1.0.M3 repackage doesn't work #14529

Closed
sharmasourabh opened this issue Sep 20, 2018 · 7 comments
Closed

spring-boot-maven-plugin:2.1.0.M3 repackage doesn't work #14529

sharmasourabh opened this issue Sep 20, 2018 · 7 comments
Labels
for: stackoverflow A question that's better suited to stackoverflow.com status: invalid An issue that we don't feel is valid

Comments

@sharmasourabh
Copy link

Spring Boot Version: 2.1.0.M3
Tool: spring-boot-maven-plugin

Issue:
Repackage does not work. When 2.1.0.M2 version is used repackage works as expected. App uses Java Modules.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 20, 2018
@wilkinsona
Copy link
Member

Thanks for the report, but "does not work" doesn't provide us with enough information to diagnose the problem. If you would like us to spend some time investigating, you will have to spend some time describing the problem and providing a minimal sample that reproduces it.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Sep 20, 2018
@sharmasourabh
Copy link
Author

Thanks for quick response.

Added sample code here
Java Version: 1.11
Maven Version: 3.5.4

λ mvn clean package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
...
...
[INFO] --- maven-jar-plugin:3.1.0:jar (default-jar) @ lib ---
[INFO] Building jar: temp\lib\target\lib-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1.0.M3:repackage (repackage) @ lib ---
[INFO] Replacing main artifact temp\lib\target\lib-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1.0.M3:repackage (default) @ lib ---
[INFO] Attaching archive temp\lib\target\lib-1.0-SNAPSHOT-exec.jar with classifier exec
[INFO]
...
...
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to temp\rest\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/dev/pws/java/other/temp/rest/src/main/java/com.packtpub.mmj.rest/module-info.java:[14,30] module not found: com.packtpub.mmj.lib
[INFO] 1 error

temp\lib\target\lib-1.0-SNAPSHOT-exec.jar file is not getting generated, though it shows in logs.

When we change the spring boot version to 2.1.0.M2 in file temp/pom.xml and run again clean package. Everything works fine and -exec jars get generated.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 20, 2018
@wilkinsona
Copy link
Member

wilkinsona commented Sep 20, 2018

Thanks. I don't think this has anything to do with Boot itself. We upgraded a number of Maven Plugins in 2.1 M3 and I suspect one of those is now catching a problem that was not being caught previously.

There are a few things that aren't right with your projects:

  • By configuring Spring Boot's Maven plugin in the parent, you have applied it to both your lib module and your rest module. Its configuration should be moved to your rest module as that's the only module that is a Spring Boot application.
  • Your module-info.java files are in the wrong place. They should be in src/main/java of each module.
  • Your other java code is in the wrong place. For example lib/src/main/java/com.packtpub.mmj.lib/com/packtpub/mmj/lib/Calculation.java should be lib/src/main/java/com/packtpub/mmj/lib/Calculation.java

With these problems corrected, I can build your project using Maven 3.5.4 with Spring Boot 2.0 M3. If you require any further guidance, please ask a question on Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid for: stackoverflow A question that's better suited to stackoverflow.com and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Sep 20, 2018
@sharmasourabh
Copy link
Author

Thanks Andy for clarifying why it was working for 2.1 M2, and not M3.
Original code is according to point #2 & #3. I just play around and modified it due to M2/M3 stuff.

@sleroy
Copy link

sleroy commented Oct 31, 2018

I had the same issue with 2.1.0

@wilkinsona
Copy link
Member

@sleroy Are you sure you have the same problem? The problem reported here was caused by some problems in @sharmasourabh's project rather than in Spring Boot and was a problem during compilation rather than repackaging. If you're looking for some help, please ask a question on Stack Overflow or come and chat on Gitter. If you believe you've found a bug, please open a new issue with a complete, minimal example of the problem you're seeing.

@hacbq
Copy link

hacbq commented Nov 26, 2018

@sleroy you must add "repackage"
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#maven-plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

5 participants