问题
I'm providing a quick and easy way for users to deploy my Java EE 6 application via glassfish-embedded-maven-plugin, so they don't have to install and configure a standalone glassfish. However, I'm running into trouble with resource deployment.
The app needs a JavaMail resource from the container, and needs a JAAS realm with a suitable role->user/group mapping.
When deploying to a standalone glassfish this is easily provided with a sun-resources.xml file and/or a couple of asadmin commands. However, I'm struggling to figure out how to do it with glassfish embedded.
Is there a way I can auto-deploy a glassfish-resources.xml in my pom as part of the glassfish-embedded-maven-plugin invocation? The documentation for the plugin is nearly nonexistent or refers to the badly out of date 2.1 version, and I'm increasingly stuck.
回答1:
It looks like the maven-embedded-glassfish-plugin is just too limited for this use case.
Instead, use the embedded glassfish api. This has changed completely in 3.1, but most of the web refers to the old 3.0.1 api, so most examples you can find will be wrong. Start here:
http://embedded-glassfish.java.net/nonav/apidocs/org/glassfish/embeddable/GlassFish.html
来源:https://stackoverflow.com/questions/5455268/glassfish-embedded-maven-plugin-how-to-deploy-resources