Let's say you write a microservice, which includes (API) libraries as Maven dependencies (in compile scope). Then you will only include them in your project; you don't modify them. Additionally you want to share your application only as source code; not in binary form or the like.
In this case, you do not modify and/or redestribute code of the dependencies.
So: Do you need to include licenses for these dependencies? Do you need to include licences of dependencies, that aren't modified nor redestributed but only referenced by your application?