0

I have created a library and exported it as a jar. The library has a couple of dependencies as AspectJ and springfox. Every time an application adds this as a dependency in pom.xml, it has to add dependencies as SpringFox and Aspectj as well into its pom.xml.

Is there an option in Maven through which we can avoid this step of adding these dependencies?

Apurv
  • 315
  • 5
  • 14

1 Answers1

0

No need for any option. If the pom.xml of your library references AspectJ and springfox, then these are inherited by all projects that use your library.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • It didn't work. After I removed the dependency for springfox from application's pom.xml, I started getting errors like this:- Error creating bean with name 'apiListingScanner' defined in URL [jar:file: Error creating bean with name 'apiDocumentationScanner' defined in URL [jar:file: Any clue why? – Apurv Nov 06 '17 at 08:50
  • Look at `mvn dependency:tree` and see if your expected dependencies are really at the right places in the dependency graph. – J Fabian Meier Nov 06 '17 at 09:00
  • Yes it's there, ` +- io.springfox:springfox-swagger2:jar:2.7.0:compile [INFO] | | +- io.swagger:swagger-annotations:jar:1.5.13:compile [INFO] | | +- io.swagger:swagger-models:jar:1.5.13:compile [INFO] | | +- io.springfox:springfox-spi:jar:2.7.0:compile [INFO] | | | \- io.springfox:springfox-core:jar:2.7.0:compile [INFO] | | | \- net.bytebuddy:byte-buddy:jar:1.6.14:compile ` Under the library I have the above mentioned dependencies. – Apurv Nov 06 '17 at 09:07
  • Then they should also be on the classpath (you can see this with `dependency:list`). So they should be avaiable for compilation. – J Fabian Meier Nov 06 '17 at 09:57
  • yes its there but still no luck, the dependency ain't being resolved. – Apurv Nov 06 '17 at 10:44
  • Please add to your question what exactly you are doing. Do you have compile problems or runtime problems? – J Fabian Meier Nov 06 '17 at 11:51