Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8813235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:47:50+00:00 2026-06-14T03:47:50+00:00

How can maven be configured to support this type of workflow: One Time Setup

  • 0

How can maven be configured to support this type of workflow:

One Time Setup Invoke maven to do one time setup of a developers machine such as

  1. Create a custom version of tomcat configured for this application
  2. Create a local postgres database on the developers machine
  3. load sample data into the database
  4. run a junit test to configure other resources needed to run the application

Integration Tests Invoke maven to do run integration tests which should do the following

  1. Create an integration test db
  2. setup the db
  3. Run command line integration tests against the db
  4. Run a test version of tomcat with the application in it
  5. Run command line junit tests that test the restful services exposed by the application

Release Build Invoke maven to do a release build of the system

  1. do all the steps for an integration test
  2. generate resources and configurations that are used on the server rather than production
  3. deposit the end result in a git repo, commit, and push the changes to production

Test Build Invoke maven to do a test build of the system

  1. do all the steps of a release build but configure the test release package with test server configuration

The main thing I am struggling with is that maven has a single build life-cycle with a well defined sequence of phases not sure if the workflow I want to build is a good fit for maven.

Can maven be configured for this type of workflow? If yes what are the key features of maven that allow for the different configurations of the four main ways that I want to use maven?

Update What I mean by this workflow, is that I want to be able to do something like

mvn setup 
mvn integration 
mvn prod-release
mvn test-release 

I know the above example look like ant, I am long time ant user and total noob with maven.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:47:51+00:00Added an answer on June 14, 2026 at 3:47 am

    You could setup Maven to do all that…

    You probably would use (shock horror) profiles to achieve some of this…

    BUT you don’t want to do that

    You are following ANT style thinking… if you like that style of thinking then use ANT or Gradle and be happy.

    If you want to follow the Maven way, then you will solve the problem differently.

    Coming from the Maven way, here are my thoughts:

    1. Why do you need one-time setup? I usually have a run profile that dynamically provisions the correct application server and starts it with the App deployed, tearing down everything afterwards when I hit ^C. Typically this involves starting up a database server or two… hence things I have developed like the cassandra-maven-plugin. That way when I am working on a different project (which could be in 10 minutes time) I don’t have to worry about background database servers eating up all my laptop’s ram.

    2. Integration tests are actually trivial when you have the above working… in fact I created the Maven Failsafe Plugin to make it easy to have plugin execution tied to the appropriate phases for integration testing. The Maven convention is to have a profile called run-its for running integration tests.

    3. Release builds being different from test builds… ugh! You should be building environment agnostic artifacts. Have them pick up their configuration from the environment they are deployed in. That removes the worry that something has changed between the “test” build and the “production” build. If you really need to bundle the config, then I usually would resort to a separate module for taking the agnostic artifact and rebundling with the required configuration. That way it is easy to prove that you have a reproducible transformation and that nothing has changed inbetween what went to QA vs what is going to Ops.

    4. I always make the release builds include the integration testing.

    So typically I have my projects such that

    $ mvn -Prun
    

    will fire up the application starting from zero. Hitting ^C will tear everything back down again, and mvn clean or in extreme situations if I have a more complex setup process and need some caching mvn post-clean (think really clean) will remove anything that the run profile put into play

    To run the integration tests I typically do

    $ mvn -Prun-its verify
    

    To make a release I typically do

    $ mvn release:prepare release:perform -B
    

    That is (in my view) the ideal way of handling the above steps you need.

    HTH.

    BTW I have not had to use PostgreSQL specifically (typically my integration tests and run profile can get away with a pure java database such as derby or hsqldb and because the artifacts are environment agnostic it is easy to have the integration test/dev flyweight app server inject the correct JDBC url) so you may hit some issues with regard to PostgreSQL

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can use this maven plugin maven-jaxb-plugin to generate Java Classes from XSD file.
Can Maven copy local file to a remote server using SSH? I want to
What Maven repository can I use for EJB 3.1 API dependency?
How can we used Maven for android? I'm using Lint tool in android for
Can anyone recommend a good hosting provider where we can host our Maven 2
Can I make a single maven project that can be included as a dependency
How can I change the user-agent in Maven? I need to be able to
How can I generate an episode with maven? I now get an error message:
How can I fix the missing artifact error in maven with the com.sun.jndi.ldap ?
I wonder whether I can setting up a private maven repository based on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.