0

Not an expert but Gradle is what the (Spring Boot) project is using. I have a @Component which runs setting up dummy data, but I only want it to run locally. So now I have put an @Profile("local123") over it too and this turns the component off. Great.

Next I wanted to put in Eclipse's Run Configurations... > JVM Arguments the -Dspring.profiles.active=local123 so that the component is turned on but only when I'm running my build locally. No joy. I have seen some posts that say you need to add this or similar to build.gradle

bootRun {
    systemProperties System.properties
}

but anywhere I try to add it in the file, it causes my build to crash.

  1. Where am I going wrong? and/or
  2. Where do I get documentation on the structure of build.gradle to work out where this should go!
Scala Enthusiast
  • 399
  • 8
  • 18
  • You need an `application-local123.properties` file in the same directory as `application.profile`. – LMC Jun 14 '18 at 23:15
  • @LuisMuñoz, I put in a blank application-local123.yml file both with _"Could not find method bootRun() for arguments"_ and without _"Task 'bootRun' not found in root project"_ the bootRun section in build.gradle and neither works. – Scala Enthusiast Jun 18 '18 at 08:51
  • why blank, should have the same as the base .properties. – LMC Jun 18 '18 at 13:26
  • :( No joy unfortunately. Still giving me: "Could not find method bootRun() for arguments". I was hoping the contents of the application file would be inherited from the default one? – Scala Enthusiast Jun 18 '18 at 13:55
  • https://stackoverflow.com/a/40642636/2834978 – LMC Jun 18 '18 at 14:20
  • Still no joy. Had the `org.springframework.boot` one of those included all along. Included an empty buildInfo{} block but doesn't seem to have made any difference. – Scala Enthusiast Jun 18 '18 at 16:08
  • are you sure the error is related to the profile? – LMC Jun 18 '18 at 17:04
  • @LuisMuñoz Yes, that is the only change I have made. Just adding the [at]Profile annotation, the switch to the VM Args and the sections to build.gradle (though I take them out each time as I don't know if they are right!) – Scala Enthusiast Jun 18 '18 at 19:27

0 Answers0