I am a newbie with maven, I created a dynamic web project in eclipse and then converted into maven project.
Instead of deploying the project in a standard container I would use embedded jetty.
How can I create in maven the appropriate jar executable with all dependencies included?
Thanks
Roberto
Found solution by myself at
http://blog.anvard.org/articles/2013/10/09/embedded-jetty-executable-maven.html
Basically we can add as many maven plugin as we want, adding dependencies and then packaging all togheter.
Related
I would like to ask, if there is some maven plugin (or another way) to generate jboss modules hierarchy (with modules.xml files) from maven dependencies (or in list of libraries for such a maven plugin) ?
I have found this plugin :
https://www.smartics.eu/confluence/display/SJBMMP/smartics+JBoss+Modules+Maven+Plugin;jsessionid=3CA5AE2D1DEB5DFB62C1E64692EDCAB6
But documentation / usage pages seem to be offline (or for some reason I cannot open page).
Thank you very much for your help !
I have tried SMARTICS plugin plugin and it created for each maven module special JAR file with ALL dependencies in it.
It is like using maven assembly plugin but all libraries are packed in standalone jar which can be placed into own jboss module. Than in your application : jboss-deployment-structure.xml you reference to this librari (e.g. jar file) and application has all libraries provided.
But splitting dependencies into own directories and generating modules.xml is not possible (confirmed by JBOSS EAP support).
I will create standalone maven project (something like "JBOSS-modules BOM project") which will generate such structure (this structure will be ready for usage on jboss).
I just would like to add an introduction to the mentioned plugin for Maven:
https://www.smartics.eu/confluence/display/BLOG/2013/10/18/Maven+Plugin+to+generate+a+Modules+Directory+for+JBoss+AS+7
The article includes screenshots that help new users to get an idea on how the plugin generates separate modules.
(I would like to comment to your answer, but unfortunately I'm some points from being entitles to do so :( )
I'm looking for creating a small web framework on top of the standard servlet-3.x specifications. Main motive is to reduce the boiler plate codes and abstractions. After I read the servlet specifications it looks without using JAX-RS or SparkJava I can create small web framework for API developments.
I'm planning to use the web-fragments method to create my framework level filters, and other beans and package it as jar. So application developer create the war project with web.xml with the metadata-complete option set to false.
I can see the web-fragment project template in eclipse but I want to develop this project using maven. With Intellij I can't see any such options for web fragment projects alone. I want to create simple maven project which ship the jar with web-fragment.xml in it, so other war projects can make use of it.
So is there any plugins or other options available to develop web fragment projects in Intellij ?
Any jar file added to the WEB-INF/lib directory of a web application is technically a "web fragment", whether it has a META-INF/web-fragment.xml file or not.
Therefore, you just need to create a maven project with "jar" packaging and import it into Intellij Idea.
Create a maven project for the fragment. Set the packaging to jar. There is no need to create a war project.
Configure an empty Artifact in the Project Structure dialog:
Using the toolbar buttons, add the WEB-INF/lib folders. Then create an Archive and add the compile output:
Add a Tomcat run configuration, and in the Deployment tab, add the Artifact you just created:
I created an example project that includes all that: https://github.com/ThomasR/web-fragment-idea. Please note that it requires TomEE+.
I have removed pom.xml from my eclipse project folder.
And I choose run on server option and everything works fine.
I am new to Spring MVC and have been given this project as an interview round.
Spring version 4.0.6, Tomcat 7, Eclipse Juno
Any help here is appreciated.
pom.xml is the build configuration file for the Maven building tool, Using Maven is optional as you can use any building tool of choice, for example Ant, Maven, Gradle ... etc
The idea behind this build configuration file is that you can define all your dependencies of your project (Spring, Struts, Hibernate, ... etc), source code repository, test cases classes, war file generation info, any other configuration for your project. and If you want to give me your project, you could only give me that pom.xml, and I would simply run maven on this file, and it will download your source code and dependencies, run test cases, build war file and deploy it on application server.
For more information, check the POM reference here
pom.xml is a maven configuration file. You don't need it to run a Spring MVC application.
Having said this, sin maven is what you usually use to build a project, you are not going to be able to build it again if you removed the pom.xml file.
Possible reasons:
You did not reference any Spring MVC class in your Web Appliction
Your Tomcat already has the Spring MVC in its libraries
Spring MVC libraries are copied in your Lib folder of your Web project, so they are carried along within the war (or exploded by the Tomcat plug-in for Eclipse).
As Pablo pointed out, you do not need Maven to add dependencies to your projects.
I want to create a adobe flex blazeds project. How can I create the project using the blazeds.war as the project template ?
war -> maven
you can't do that, there's no way maven can guess how the war was produced only by analyzing the result
generating a project stub for blazeds
that you can do. You can used a defined archetype like this one: http://code.google.com/p/maven-blazeds-spring-archetype/
it will force you to stick to the technology (spring) chosen by the archetype developer, however.
I am new to maven and as a matter of fact new to the build tools and process or should i say the whole web structure. I have a slight problem for which i need help.
I am going to make a web project which on compiling/deployment will give a war file. And i have a separate project for which the war(just the war file after bundling the project) file will be given to me.
Now my requirement is to make a EAR file comprising both my project bundle and also including the war of the other completed project. I need to use maven for this.
I know the multi-module projects can be created using maven. But i am not sure how it will handle isolated war file. I mean for my project it will have the whole structure , artifactId and groupId. What about the other war how will it be handled.
I know this may be a novice question. But can someone please help.
Thanks
The way this would typically be handled would be making the isolated WAR file a dependency. Install it in your local maven repo and just list it as a dependency in the POM for your EAR module. Also, making your WAR project a module under your EAR project would handle the WAR that you're actually building.