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 7085391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:25:07+00:00 2026-05-28T07:25:07+00:00

I have some properties in two bash scripts I want substituted when running mvn

  • 0

I have some properties in two bash scripts I want substituted when running mvn test, such that one script might be executed before the test phase, and one after, using the exec-maven-plugin.

The bash scripts look like so:

startMongo

#!/bin/bash

${mongodNixDirLocation}/mongod --fork --logpath "${mongodLogDir}" --port ${mongodbTestPort}

/bin/sleep 10

stopMongo

#!/bin/bash

mongoDbServer=`lsof -i tcp:${mongodbTestPort}| awk 'NR!=1 {print $2}'`

for i in $mongoDbServer; do
    echo "Stopping mongo DB server instance: $i"
    kill -s SIGINT $i
done

I seem to be having issues with the order of execution when I run mvn test. The output is like so.

The exec-maven-plugin is trying to execute the startMongo script before the proper substitutions have been made – hence the error message appearing to execute mongod from /mongod.

If I run mvn process-test-resources, the substitutions are correctly made, and I can manually run the script successfully.

My pom.xml is configured like so. How can I appropriately configure the correct phases such that this will work?

  • 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-05-28T07:25:08+00:00Added an answer on May 28, 2026 at 7:25 am

    It looks like the problem is in the following line:

    <executable>src/test/resources/startMongo</executable>
    

    If this script – startMango – needs filtering, the filtering will be done and the result places in target/test-classes folder. The original file will not be updated.

    How about altering the above line as:

    <executable>${project.build.directory}/test-classes/startMongo</executable>
    

    Likewise for stopMongo as well.

    I am not sure how it manually worked though.

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

Sidebar

Related Questions

I have some logic that depends upon two properties being set, as it executes
I have a class that has some properties. And I want something that calculates
I have two objects that contain some properties that are exactly the same (same
The Application class in System.Windows.Forms have a some properties that can be quite useful.
i have some element in my container and want to save all properties of
Basically I have some class objects, each with three properties. Once one class object
Some projects have properties have miscellaneous settings such as: AllowPayments, ShowSideBar, SectionTitle. Really things
I have some class with properties firstName and lastName. I want bind TextBlock to
I have several classes that need to load some properties files, and I was
I have a ViewModel that encapsulates some properties that are being edited in an

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.