Use of classifier tag in Maven dependencyManagement
09:32 28 Nov 2022

Good morning,

I am working on a multi-module Maven project in which child modules inherit from a parent information regarding dependencies, this is done with the tag.

I am now trying to import the following library:

        net.sf.json-lib
        json-lib

following this way:

Parent pom

     
         
            net.sf.json-lib
            json-lib
            ${version.json-lib}
            jdk15
         
     

child pom

   
        net.sf.json-lib
        json-lib
    

I thought this could be enough as the dependency management section of the parent should take care of making inheritable all necessary information, but this is not the case.

In particular I always get

'dependencies.dependency.version' for net.sf.json-lib:json-lib:jar is missing.

while using mvn clean install command.

I have tried adding classifier tag also on child pom and it seems to work, but it seems to me like a dirty workaround also because I have now classifier information duplicated both in parent and child pom (If I delete the classifier information from parent, Maven cannot find the dependency again).

I searched the net for a while and found no proper or clear documentation about this, can someone clear this out a bit please?

Thanks in advance.

java maven