Maven test worked fine on my laptop but not in the pipeline

Sean Su
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 29, 2023

I have a simple JUnit test case that load the Liquibase changelog originating in the src/test/resources folder. As you can imagine, the file will be in the target/test-classes folder after the compilation. The test case worked perfectly on my laptop. However, it failed as Liquibase could not find the file. The only thing I can think of is that the target/test-classes somehow is not on the classpath in the pipeline environment. Is that even possible? My pipeline configuration is very simple: 

image: maven:latest

pipelines:
default:

- step:
name: Run Maven Tests
script:
# Step 2: Maven commands
- echo "start of maven tests."
- mvn clean test
- echo "end of maven tests."

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 30, 2023

Hi Sean,

The pipeline build directory should be the clone directory of the repository. If it's unable to find the target/test-classes folder then I'd suggest running an ls -l command in your script to print your folder structure and verify if it's there or not.

Sometimes you may also have to add prefixes to paths such as ./target/test-classes

Please try this and let me know how it goes.

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events