It's quite easy, you'll only have to add a runprofile to your pom.xmllike this Īfter that you'll only have to type mvn -Prun to build your app, launch Jetty and deploy the app in it. With that Weld will be able to decorate Jetty inner servlet class to add CDI Injection support in it. ServletContextHandler.Decoratorĭont miss the - in, it's the way to tell Jetty that a class is no more an inner class and can be seen by the webapp. Īnd eventually if you want to be able to inject bean in servlet you need to ask Jetty to expose some of its inner class by creating the following jetty-web.xml file in your WEB-INF directory Any external libraries that are required by the project are listed as dependencies in the POM. In web.xml you add the listener and expose the JNDI resource . Each Maven project contains a pom.xml file that contains details about the contents of archives. In jetty-env.xml you declare the JNDI ressources Note the fact that i'm using weld-servletdependency which contains all needed Weld and CDI classes.
MAVEN INSTALL WAR FILE INSTALL
Then type the following command to install the Java. Next, type heroku login to sign in your Heroku account in Heroku CLI.
MAVEN INSTALL WAR FILE HOW TO
Also check out how to install Tomcat server here. The result is a WAR file created under target folder of the project: 2. Maven - Using tomcat-maven-plugin to deploy war file to Tomcat server Last Updated: Jan 9, 2018. The following config works for me on Jetty 8.x and 9.0.x (not 9.1+ for the moment) In case you use Eclipse IDE, right-click on project and select Run As > Maven goal and specify the goal package. Using the mvn:war:exploded command, we can generate the exploded WAR as a directory inside the target directory.
I have included the weld-servlet jar in my pom and also added the weld listener to the web.xml, however it still does not work.For example, I get the following error on startup: 15:30:50 : Checking for BeanManager under JNDI key java:comp/BeanManagerġ5:30:50 : BeanManager lookup failed for JNDI key java:comp/BeanManager Since out of the box Jetty does not come with CDI or JNDI, I am trying to add support for these but running into some issues. The purpose of this is for a quick integration test of some of the functionality in said war file.
![maven install war file maven install war file](https://www.vogella.com/tutorials/ApacheMaven/img/m2e_settings10.png)
![maven install war file maven install war file](https://static.packt-cdn.com/products/9781788471060/graphics/7e864b44-917e-4fae-b07c-2a56881b46ec.png)
I have a maven project in IntelliJ where I am trying to deploy a war file to a jetty container.