metaparticle-io / package

Metaparticle/Package: Language Fluent Containerization and Deployment in Java, .NET and Javascript (and more coming soon)
https://metaparticle.io
MIT License
493 stars 55 forks source link

Java: Consider using APT to separate build- and runtime #130

Open rhuss opened 6 years ago

rhuss commented 6 years ago

For the Java variant at least Metaparticle mixes heavily build and runtime aspect which makes is more or useless in more serious setups where you don't want to build you application when you want to just run it. This results in issuea when distributing the application via standard Maven semantics (mvn deploy) as you don't have the source available then when running it (nor any pom.xml for calling it)

Despite that I consider putting build configuration into the source code a strong anti-pattern (like a path to the generated jar code, which btw can be completely in a different spot depending on you build configuration in the pom.xml), have you considered to use APT which evaluates annotations during compile time, and not runtime ? This might be still to early as for building Docker images already needs the packaged jars, so I really think a dedicated Maven plugin which is put in the right spot of the Maven lifecycle (right after package) makes things much more straightforward then to go forth and back by calling mvn (again) when executing the compiled application.

For Java, the build flow doesn't really feel right to me.