Maven build succeeds without required depencency

39 Views Asked by At

I have a dependency com.somecompany.somelib in my maven module which is required.

I have classes in my source code which consume this dependency.

If I remove this dependency from my classpath in intellij, I see that my build for module fails in intellij (expected).

However this is not the case when I do mvn clean install on this module via the command line after removing the dependency from pom.xml. The build still succeeds where it should fail! (not expected)

I have checked with the --debug option enabled and I do not see the dependency being added. I see the class files being compiled and even the .class files in the resultant .jar file.

There is no occurrence of this dependency name in the --debug log.

I have spent a full day searching and reading but could not find any resolution/possible causes.

Below is some additional info if it helps.

maven version - Apache maven 3.6.0

basedir = /home/user/git/repo/projectname/modulename

buildDirectory = /home/user/git/repo/projectname/modulename/target

compileSourceRoots = [/home/user/git/repo/projectname/modulename/src/main/java]

compilerId = javac

debug = true

encoding = UTF-8

failOnError = true

forceJavacCompilerUse = false

fork = false

optimize = false

source = 8

staleMillis = 0

target = 8

useIncrementalCompilation = true

verbose = false

0

There are 0 best solutions below