0

The Spring Boot Maven Plugin has a boolean property called "attach", documented here. I've read the documentation, but I don't understand the documentation. Would anyone be willing to explain this to me? When this property is set to "true", what happens to the original jar and the fat jar? When this property is set to "false", now what happens to the original jar and the fat jar.

Thanks!

Mathew Alden
  • 1,458
  • 2
  • 15
  • 34

1 Answers1

2

The attach property controls whether or not the repackaged (fat) jar is attached. When a jar is attached it means that it will installed into your local Maven repository or deployed to a remote repository.

When the property is set to true (the default) the fat jar will be installed or deployed. If no classifier has been configured, it will replace the normal jar. If a classifier has been configured such that the normal jar and the repackaged jar are different, it will be attached alongside the normal jar.

When the property is set to false the fat jar will not be installed or deployed.

I've opened an issue so that we can improve Spring Boot's documentation.

Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242
  • So it changes which jar - the original or the fat - is deployed during Maven's `deploy` goal? Cool, that makes a lot more sense; I hadn't understood what the documentation meant by "deploy". Thanks! – Mathew Alden Nov 14 '19 at 20:35
  • It doesn't really do that. It just determines whether the fatjar is going to be "attached" to the lifecycle, and therefore installed or deployed if necessary. The replacement Andy mentioned is unrelated to whether `attach` is set or not. – Stephane Nicoll Nov 15 '19 at 06:56