reines / dropwizard-debpkg-maven-plugin Goto Github PK
View Code? Open in Web Editor NEWA maven plugin for packing Dropwizard applications as Debian packages.
License: Apache License 2.0
A maven plugin for packing Dropwizard applications as Debian packages.
License: Apache License 2.0
Currently we hardcode a few, and only allow -Xms=-Xmx to be set. We should make this more flexible.
We should be able to validate both the YAML syntax and the contents using dropwizard-configuration.
If the project description from the pom.xml is longish, the build fails with this exception:
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to create Debian package
at com.jamierf.dropwizard.debpkg.DropwizardMojo.createPackage(DropwizardMojo.java:207)
at com.jamierf.dropwizard.debpkg.DropwizardMojo.execute(DropwizardMojo.java:112)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: org.vafer.jdeb.PackagingException: Failed to create debian package /home/martin/workspaces/git2/dead-listings-service/target/dead-listings-service-1.0-SNAPSHOT.deb
at org.vafer.jdeb.DebMaker.makeDeb(DebMaker.java:298)
at com.jamierf.dropwizard.debpkg.packaging.PackageBuilder.createPackage(PackageBuilder.java:63)
at com.jamierf.dropwizard.debpkg.DropwizardMojo.createPackage(DropwizardMojo.java:203)
... 23 more
Caused by: org.vafer.jdeb.PackagingException: Could not create deb package
at org.vafer.jdeb.DebMaker.createSignedDeb(DebMaker.java:527)
at org.vafer.jdeb.DebMaker.createDeb(DebMaker.java:418)
at org.vafer.jdeb.DebMaker.makeDeb(DebMaker.java:294)
... 25 more
Caused by: java.text.ParseException: Line misses ':' delimiter
at org.vafer.jdeb.debian.ControlFile.parse(ControlFile.java:81)
at org.vafer.jdeb.debian.ControlFile.parse(ControlFile.java:45)
at org.vafer.jdeb.debian.BinaryPackageControlFile.(BinaryPackageControlFile.java:60)
at org.vafer.jdeb.ControlBuilder.createPackageControlFile(ControlBuilder.java:177)
at org.vafer.jdeb.DebMaker.createSignedDeb(DebMaker.java:447)
... 27 more
I finally figured out this is because the description ends up in the file target/dropwizard-deb-package/control/control and if the description is long it is split into multiple lines, but this breaks the parse() method in the ControlFile class which expects all lines to be in {key}: {value} format.
Project packaging should be set to deb, and we should figure out the correct way to require the shade plugin and get its output jar.
Hi Jamie, thanks for this plugin its going to be really useful for me! I wanted to know how to use the configuration xml file listed in the README? Is it specified in the pom somehow or does it need a particular name or extension? I know nothing about making .deb files, sorry!
When one runs the plugin and installs the resulting debian package, I am aware that it replaces the mustache variables in the config yaml file and the resulting file is then stored in /etc/application-name.yml at the time of the package installation.
However this doesn't have an option to produce another config yaml file to run normally in commandline "java -jar target/application.jar server config.yml". So as expected when one tries to run their application on command-line, the mustache variables in the original config yaml file cause the following error :
Exception in thread "main" com.fasterxml.jackson.core.JsonParseException: Expected a field name (Scalar value in YAML), got this instead: <com.fasterxml.jackson.dataformat.yaml.snakeyaml.events.MappingStartEvent(anchor=null, tag=null, implicit=true)>
at [Source: java.io.FileInputStream@6f10d5b6; line: 5, column: 12]
Is there a way or options within the plugin to have multiple config yaml files produced (instead of the one which eventually ends in the /etc/application-name.yml) as a result of the plugin running when one packages using maven? It would be good to have a real config yaml file within the root folder of the application (or in a folder of the user's choice for that matter).
The jvm settings file forces ParNewGC, with the new G1GC in place, and with java 7 being end of life, maybe it makes sense to do one of the following:
Would it be possible to push a new release to maven central?
This project is awesome! In order to pack my dropwizard server to the world I want to be able to ship it with both deb and rpm packages.
I wanted to know if there's an RPM maven? (I tried rpm-maven-plugin but it is not as straight forward as this one)
Using only the POM version is a bit restrictive. It would be nice to be able to add a timestamp or revision number (see buildnumber-maven-plugin
) to distinguish between packages built from the same SNAPSHOT version.
<deb>
<maintainer>foo</maintainer>
<version>${project.version}.${buildNumber}</version>
</deb>
I'm running into some tracking issues when using the shell script that is launched from the upstart job. A similar discussion was had on the dropwizard-user google group at https://groups.google.com/d/msg/dropwizard-user/PPgqS2ZHeFg/xaBAE2HA4jQJ where the poster recommended using https://gist.github.com/sargun/5693318 instead of launching java inside of bash.
What are your thoughts on removing the shell scripts and modifying the upstart scripts in this manner? Have you ran into these issues before?
I think this is more user error than issue, but struggling to get this to work. I've simply added the plugin with the default configuration from the readme and I'm attempting to package my app but receive the following error:
[ERROR] Failed to execute goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.9:dwpackage (default) on project org.squandered.weather: Execution default of goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.9:dwpackage failed: Failed to find main class in artifact jar -> [Help 1]
I'm very new to maven so I think I've just not set something correctly here... Should the goal be my package?
Do you have a "in the wild" working example I can poke at?
Currently, I have added following lines in the beginning of do_stop() function to get around this issue -
SERVICEPID = $(pgrep -f -o "{{{project.artifactId}}}")
pkill -P $SERVICEPID
I can create a pull request if you find this correct. Also, if you think this is not an issue and there is some mistake on my part, please do tell.
I switched to OpenJDK 11 and it now fails with an error.
[INFO] --- dropwizard-debpkg-maven-plugin:0.10:dwpackage (default) @ money ---
[INFO] Detected Dropwizard 2.0.16, attempting to validate configuration.
class io.dropwizard.configuration.ConfigurationMetadata$1: javax/sql/DataSource
java/sql/Date
[WARNING] Failed to validate configuration
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.438 s
[INFO] Finished at: 2020-12-22T16:01:53Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.10:dwpackage (default) on project money: Execution default of goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.10:dwpackage failed: org.apache.tools.ant.ExitException: ExitException: status 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.10:dwpackage (default) on project money: Execution default of goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.10:dwpackage failed: org.apache.tools.ant.ExitException: ExitException: status 1
The relevant part from the stack trace seems to be:
at com.jamierf.dropwizard.debpkg.validation.ApplicationValidator.validateConfiguration (ApplicationValidator.java:59)
at com.jamierf.dropwizard.debpkg.validation.ApplicationValidator.validateConfiguration (ApplicationValidator.java:48)
at com.jamierf.dropwizard.debpkg.DropwizardMojo.validateApplicationConfiguration (DropwizardMojo.java:192)
at com.jamierf.dropwizard.debpkg.DropwizardMojo.execute (DropwizardMojo.java:109)
The important part from above seems to be:
class io.dropwizard.configuration.ConfigurationMetadata$1: javax/sql/DataSource
java/sql/Date
It looks like it's related to the jars that are no longer part of the OpenJDK.
If I run the DW check
command against my app's jar it works fine.
Thanks,
Darren.
When I up the version of dropwizard my project uses from 0.8.0-rc1 to rc2 or higher the mojo fails like this:
[ERROR] Failed to execute goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.8-SNAPSHOT:dwpackage (default) on project imageflare-packaging: Execution defaul
t of goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.8-SNAPSHOT:dwpackage failed: java.lang.reflect.InvocationTargetException: WRITE_DURATIONS_AS_TIMESTAM
PS -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.8-SNAPSHOT:dwpackage (default) on project imageflare-packaging: Execution default of goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.8-SNAPSHOT:dwpackage failed: java.lang.reflect.InvocationTargetException
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal com.jamierf.dropwizard:dropwizard-debpkg-maven-plugin:0.8-SNAPSHOT:dwpackage failed: java.lang.reflect.InvocationTargetException
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:144)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.google.common.base.Throwables.propagate(Throwables.java:160)
at com.jamierf.dropwizard.debpkg.validation.ApplicationValidator.validateConfiguration(ApplicationValidator.java:71)
at com.jamierf.dropwizard.debpkg.validation.ApplicationValidator.validateConfiguration(ApplicationValidator.java:48)
at com.jamierf.dropwizard.debpkg.DropwizardMojo.validateApplicationConfiguration(DropwizardMojo.java:191)
at com.jamierf.dropwizard.debpkg.DropwizardMojo.execute(DropwizardMojo.java:109)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
... 20 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.jamierf.dropwizard.debpkg.validation.ApplicationValidator.validateConfiguration(ApplicationValidator.java:59)
Looks like there's something going wrong in ApplicationValidator.validateConfiguration?
Hi Jamie, and thank you for the very good work which saved me a lot of time!
The problem I am facing is that every time I update the package with a new version, the jvm and yml configuration files are being replaced and all changes are lost.
Is there a way to add these files to DEBIAN/conffiles to avoid this ?
Thanks a lot !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.