How to manage the pier: wage war using the war defined by the maven coordinates?

Reference Information. I am creating a functional test module in a maven project. We use maven-jetty-plugin for testing.

I have a berth plugin configured as described here (to play well with the Failsafe plugin), but what I would like to do is deploy the war artifact from our main web module using the berth (which has just been installed in the local repository maven by the time the functional test module was launched).

In the bridgehead plugin, the goal of warfare is the <webApp> element, which takes the string path to deploying the war. I would rather clarify the deployment war using the maven coordinates defined by our web module. Is there any way to do this?

Possible workarounds:

  • Section 4.13 “Better Builds with Maven” describes the use of cargo to deploy a war indicated using maven coordinates, but this is a serious overflow given that we are using a berth.
  • A more reasonable IMO uses a dependency: copy to copy the newly created and installed artifact of war to a fixed path in the target directory of the functional test module, which I can then provide in the configuration element of the <webApp> prefix.
+6
maven maven-2 jetty maven-jetty-plugin
source share
1 answer

The solder bridgehead command line goal has an element that takes the string path to war for deployment. I would rather clarify the deployment war using the maven coordinates defined by our web module. Is there any way to do this?

It is not really assumed that the maven jetty plugin is used, the plugin deploys the war of the current module, what you want to do is not supported by default.

Section 4.13, “Improving assembly with Maven,” describes how to use the load to deploy a war specified using maven coordinates,

Yes, Cargo can do it in a clean way.

but this is a serious overflow given that we use the pier.

I do not agree. Firstly, the berth plugin does not support what you want to do out of the box (so it may not be the right tool). Secondly, a serious search is very exaggerated, in fact this is a mistake, especially considering that the required load requires a very small configuration (zero?) For the built-in Jetty.

A more reasonable IMO uses the dependency: copy to copy the newly created and installed artifact of war to a fixed path in the target directory of the functional test module

Do not be offended, but your whole question sounds a bit like: I have a hammer, this is normal for a nail, can I use it for a screw, given that getting a screwdriver seems like a serious excess? To answer this question (something you say), you can use dependency:copy and get everything that works with the maven plugin, but it is a hack (and since you are not really asking any questions, I think you would like to get an opinion on this). Of course, the final decision is yours :)

Just in case, here's how I will implement this with Cargo:

 <dependencies> <dependency> <groupId>war group id</groupId> <artifactId>war artifact id</artifactId> <type>war</type> <version>war version</version> </dependency> ... </dependencies> ... <build> <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <configuration> <!-- Container configuration --> <container> <containerId>jetty6x</containerId> <type>embedded</type> </container> <!-- Configuration to use with the container or the deployer --> <configuration> <deployables> <deployable> <groupId>war group id</groupId> <artifactId>war artifact id</artifactId> <type>war</type> <properties> <context>war context</context> </properties> </deployable> </deployables> </configuration> <!-- Don't wait, execute the tests after the container is started --> <wait>false</wait> </configuration> <executions> <execution> <id>start-container</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <id>stop-container</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> ... </plugins> ... </build> 

And I do not think that this can be objectively qualified as a "serious bust".

+9
source share

All Articles