Kjeld
Kjeld

Reputation: 470

Maven dependency for local use only

is it possible to have a dependency in my Maven pom, which will only be used locally in my development environment?

I need a dependency to PostgreSQL when developing locally in my IDE, since I am using Postgres only locally. On T, A and P environments we are using a different data source, so we do not want the dependency to postgres in the build there.

It is a Spring Boot application.

Looking for a solution,

Cheers! Kjeld

Upvotes: 1

Views: 2984

Answers (1)

Kjeld
Kjeld

Reputation: 470

I have solved this by using the runtime scope for this particular dependency (thanks @khmarbaise for pointing that out). I think I was asking for the sake of asking, and I could have thought of this if I had thought about it a little more before asking the question... Then again, this might also help others. The profile suggestion might have been even better, but I have not looked into that anymore.

    <!-- FOR LOCAL IDE DEVELOPMENT ONLY -->
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>

Upvotes: 0

Related Questions