0

I noticed that the standard EAR lifecycle of Maven does not mention tests:

http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

It is true that unit tests make little sense in EARs (there is no code to compile). But what about integration tests?

To make this work I would need to add the test code to the ear and add test compile and integration test goals to the lifecycle. But, as the EAR is the only standard form of packaging without such a default binding, I guess I do something wrong.

What is the proper solution to run integration tests against an EAR?

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • Unit tests do really make no sense on an EAR as you already realized cause there is no code in a EAR module at all....integration tests only make sense (from my point of view) if you deploy an EAR otherwise what kind of tests would you like to do? So I would make a separate module and use the EAR as dependency than you might use arquillian or https://codehaus-cargo.github.io/cargo/Maven2+plugin.html to deploy to an existing App server to do some kind of integration tests..other solution using docker container and deploy into container and run against that ..? – khmarbaise Feb 05 '20 at 12:02
  • @khmarbaise You are right, you need to deploy the ear. The question is: Does it make sense to include such integration into the ear build? Or should I create a separate module for the integration tests? – J Fabian Meier Feb 05 '20 at 12:17
  • I would go cleanly for a separate module .... – khmarbaise Feb 05 '20 at 12:19

0 Answers0