title: How to remove a dependency in Gradle depending on the Spring Boot runtime environment?
body: <p>Not sure if this is a Gradle question or a Spring Boot one, but here goes...</p>
  
  <p>I am using Spring security and LDAP in a spring boot application.</p>
  
  <p>I have the following dependencies in my build.gradle:</p>
  
  <pre><code>compile 'org.springframework.security:spring-security-ldap:3.2.4.RELEASE'
  compile 'org.apache.directory.server:apacheds-server-jndi:1.5.5'
  </code></pre>
  
  <p>The second of these supplies an embedded LDAP server that is only needed during development.</p>
  
  <p>I have established a SB @Profile and configure/load an LDIF file into the embedded server within a class that has the @Profile('development') annotation.</p>
  
  <p>The question is: how to remove the second dependency when not in dev mode?</p>
  
  <p>I establish the spring.profiles.active property within my config/application.yml file, thusly:</p>
  
  <pre><code>spring:
    profiles:
      active: development
  </code></pre>
  
  <p>Can I reference spring.profiles.active so that I can somehow exclude the unneeded dependency?</p>