Home > Software engineering >  Maven file and profile at the same time not working?
Maven file and profile at the same time not working?

Time:12-24

I'm trying to execute a maven command like the following:

mvn clean install -f ../<some-path>/pom.xml -Pear -DskipTests

For some reason this command is not working correctly. The profile is not getting applied. What is the problem here?

CodePudding user response:

I think maybe -f doesn't work as you think it does. See this answer: How to run Maven from another directory (without cd to project dir)?

If your project uses relative pom locations, this breaks.

See also: https://maven.apache.org/plugin-developers/common-bugs.html#Resolving_Relative_Paths

CodePudding user response:

cd ..
call mvn -DskipTests -Pear clean install
cd <some-path>

I did it like this now and it works. Thanks for @Adriaan Koster for the hint with the relative poms. That seems to have been it. And maybe i should use absolute paths instead :)

  • Related