Why 2 versions of Jetty Maven plugins? - jetty

I set up a new webapp Maven project and wanted to test it with Jetty's Maven plugin.
So I issued the console command: mvn jetty:run
After defining the pluginGroup in Maven's settings file I ran once again the command.
Unfortunately, it failed because I was using one of the below mentioned versions of the plugin:
maven-jetty-plugin
jetty-maven-plugin
Why are there 2 Maven based plugins for achieving the same thing - running Jetty? Why do they have to bring so much confusion?
Or be so kind as to explain me the differences between them.

With Jetty7 this plugin was renamed to jetty-maven-plugin to better conform to maven2 convention. The Jetty 7 version of the plugin has also undergone substantial changes in configuration. For more information, see the Jetty 7 Maven Plugin feature guide.
See the docs here

The maven-jetty-plugin is for Jetty 6 and jetty-maven-plugin is for Jetty7 and later. The name change was made to "adhere with maven plugin naming conventions" and is part of the big mess created by the move of Jetty to the Eclipse Foundation. Actually, Jetty 7 is considered as a transition version (this must be the politically correct expression for big mess).

Related

Leiningen raises "Tried to use insecure HTTP repository without TLS." but for which dependency?

I'm using Leiningen to run a Clojure project on my Raspberry Pi 3 (running stretch), previously I used version 2.7.1 with no problems, but upgrading to the latest version on lein (2.8.1) I now get this error for some of the dependencies (but not others):
Tried to use insecure HTTP repository without TLS
However, lein doesn't tell me which dependencies are causing problems, so how do I discover which ones cause this error?
Also is it possible to disable this security feature for certain dependencies? I'm only running on a home network so consider this acceptable.
Answer edited after a comment correctly pointed out that the first method was showing only the immediate dependencies.
Generate the Maven POM:
lein pom
Wrote .../pom.xml
Following this answer for Java https://stackoverflow.com/a/3270067/561422, use the Maven dependency plugin:
mvn dependency:purge-local-repository > raw.txt
Open raw.txt in an editor and search for the string http:, that should point you on the right track.
For example with Unix command-line tools:
Unsafe repos (searching for http:):
grep http: raw.txt
Downloading from example: http://unsafe.example.org
[Note: this is not my preferred solution, but it got my project working again].
Use Leiningen 2.7.1, which doesn't have such strict security checks. Download from:
https://raw.githubusercontent.com/technomancy/leiningen/2.7.1/bin/lein
It's a bit difficult to see which extension causes the problem as they can include other deps as well.
You can still download the extension though.
From the lein FAQ;
This is very insecure and exposes you to trivially-executed man-in-the-middle attacks. In the rare event that you don't care about the security of the machines running your project, you can re-enable support for unprotected repositories by putting this at the top of your project.clj file:
;; allow insecure downloads
(require 'cemerick.pomegranate.aether)
(cemerick.pomegranate.aether/register-wagon-factory!
"http" #(org.apache.maven.wagon.providers.http.HttpWagon.))
For me this worked on several older project that were not updated. In the logs you can easily track which package was downloaded via http.
So this answers the : "Is it possible to disable the security" feature question from the OP.
The other question seems to have an answer on StackOverflow already. Display complete dependency tree with Leiningen

WebPack on VSTS Hosted Build

We're using the hosted build agent on VSTS to build and release our ASP.NET Core code to Azure App service.
My question is: can we run WebPack to handle front-end tasks on this hosted build on VSTS or do we have to do it manually before checking the code into our repository?
Update:
I'm utilizing the new ASP.NET Core Build (Preview) template that's available on VSTS -- see below:
Here are the steps -- out of the box:
For VSTS we're working on an extension, currently it's in beta phase, you can ask for a share.
Check the VSTS marketplace.
Check this github repo.
Webpack is definitively not a first class citizen for VS2015 and VSTS. Streamlining webpack for CI/CD has been a real headache in my case, especially as webpack was introduced hastily to solve dreadful performance issues with a large monolithic SPA (ASP.NET 4.6, Kendo, 15,000 files, 2000 folders). To cut short, after trying many scenarios to make sure that freshly rebuilt bundles would end up in IIS and Azure webapp, I did a 2-pass build. The sequence of VSTS tasks is as follows: npm install global, npm install local, npm webpack install local, npm webpack install global, build pass 1, webpack, build pass 2, etc... This works with hosted and private agents, providing you supply the proper path for webpack as webpack is installed in a different location in host and in private (did not find a way to chose the webpack install location for consistency). I scorch everything before starting the build. Also need to do these in VS2015 solution : (1) unload "built" folder, and (2) Add Content Include="Built\StarStar" in project file. The "built" folder contains the bundles and should appear greyed, otherwise more bad surprises and instabilities to deal with...
Build-Pass #2 task in VSTS BUILD allows to collect the fresh bundles generated by Build-Pass #1 and includes them automatically in the package to be published.
Without a second build-pass, collecting the bundles and merging them in the zip package is a nightmare, especially when you have 15,000 files to unzip then rezip (300 ms per file!!). Did not find file-merging capability that I could readily use in VSTS.
I have my hears to the ground listening for someone coming up with a more efficient CI/CD scheme for webpack. In the meanwhile, my 2-pass-build workaround is working flawlessly, but slow indeed.
I anticipate that the advances with ASP.NET core, Angular 2 and webpack will look into solving this elegantly.

Developing in Adobe CQ5 with jetty?

We use maven to deploy the code changes to cq interner server / CRX Lite and the problem here is that it takes long time where the changes itself is often only one line code.
Has somebody experience with CQ5 with jetty and can give me a good Guide?
am not sure i understand the relationship with jetty (which ships as servlet container of latter versions of AEM/CQ5), but will answer to the code deployment part:
deploying a full content package (full content) should be done using
maven-content-package plugin for smaller deployments of content,
when you can't use integrated dev environments like sling eclipse dev
tools, i'd suggest you use the excellent repo command that basically zips the current folder and deploy it. I'm using it as an external tool command of intellij and it's really fast.
finally, if the deployment you're referring to is osgi deployment, maven sling plugin can help you with that (will still compile/package the whole osgi bundle though)

best way to deploy jetty application--too many options?

I need to deploy a production version of a web application. So far, I've been testing it with mvn jetty:run. I've used actual jetty installations before, but they seem only necessary when you want to serve multiple wars on the same web server. In some ways this is the most staightforward however (mvn package and copy it over).
My other options are to create a runnable jar (mvn assembly:single) that starts a server, but I need to tweak the configuration so that the static content src/main/webapp is served and the web.xml can be found.
I've also read about a "runnable war". This might avoid the src/main/webapp problem since these files are already laid out in the warfile. I don't know how to go about doing this, however.
I could also stick with mvn jetty:run, but this doesn't seem like the best option because then the production deployment is tied to code instead of being a standalone jar.
Any opinions on the best way or pros and cons of these different approaches? Am I missing some options?
The jetty-console-maven-plugin from simplericity is simple to use and works great. When you run mvn package you get two wars--one that is executable. java -jar mywar.war --help gives usage, which allows a bit of configuration (port, etc.).
I'm not that familiar with maven, but this is how we approach deployment using embedded Jetty:
We create a single-file JAR with the embedding jetty app and the necessary lib jars packed.
We deploy the static content in a WAR file (which you can package into the JAR as well). Everything is generated by an ANT file that:
1) Build the static files WAR (this also creates the web.xml)
2) Copies the WAR into the application resources
3) Compiles an executable JAR
To get the embedded Jetty to "find and serve" your static files, add the war with a WebAppContext to the Jetty handlers:
Server jetty = new Server(port);
HandlerList handlers = new HandlerList();
WebAppContext staticContentAsWar = new WebAppContext();
staticContentAsWar.setContextPath("/static/");
staticContentAsWar.setWar(resource_Path_to_WAR);
handlers.addHandler(set);
jetty.setHandlers(handlers);
jetty.start();
HTH

Tapestry webapp with embedded Jetty

How can I configure a Tapestry5 project to run standalone (via java -jar) with embedded Jetty?
I'm looking for a short "recipe" regarding Tapestry5, Jetty, configuration of servlets/ handlers/ whatever is needed to connect the dots...
I've seen a few dots: How to Create an Executable War, Configuring Tapestry (ref Tapestry as servlet filter)
Edit: I'm thinking about a standalone running webapp due to server circumstances. It doesn't have to be embedded Jetty, but I can't rely on a stable appserver. Still looking for a recipe, though, so I don't spend much time on dead ends...
Also, I'd like for Jenkins (Hudson) to be able to stop and start the server automatically when deploying updates - I don't know if that influences what I can do with Jetty, f.ex.
Well, i believe this is a general "how to run a war question". Assuming you indeed have a war, you can use jetty or winstone to "run" it - see :
http://winstone.sourceforge.net
and
http://www.enavigo.com/2008/08/29/deploying-a-web-application-to-jetty/
In the first case, you can directly do
java -jar winstone.jar --warfile=<warfile>
https://github.com/ccordenier/tapestry5-hotel-booking/
<-- Check its maven build
http://tapestry.zones.apache.org:8180/tapestry5-hotel-booking/signin
I did some digging, and this is the short recipe I basically ended up following:
Start with the Maven Jetty plugin as configured in the pom.xml of the Tapestry 5 archetype
Add the stopKey and stopPort attribute to Maven Jetty plugin configuration
Let Jenkins CI run maven target jetty:stop and then clean install
Let Jenkins run shell script mvn jetty:run &
Voila - my Java app is up and running with automatically updated code, without any appserver.