I use this command to run my spring application - java -jar -Dspring.profiles.active=native ddwa-services-app/target/ddwa-services-app-1.0-SNAPSHOT.jar, but when run the application from IDE, I need to add run configuration, below is the screenshot showing what I have added, but it does not work for me.
            Asked
            
        
        
            Active
            
        
            Viewed 1.1k times
        
    4
            
            
         
    
    
        abhi
        
- 1,920
- 6
- 24
- 27
- 
                    1You can use Jar Application configuration if you want to run it the same way you do it from the command line. – CrazyCoder Aug 08 '19 at 00:18
- 
                    where should I include this `java -jar -Dspring.profiles.active=native` – abhi Aug 08 '19 at 00:22
- 
                    1https://i.imgur.com/tPfDYXc.png. You specify the path to jar and add `-Dspring.profiles.active=native` to the VM Options. You don't need the `java -jar` part. – CrazyCoder Aug 08 '19 at 00:38
1 Answers
6
            
            
        Looking at my working Spring Boot 2.0.4 app configuration, I can suggest you to try these:
- Correct syntax for spring profiles is - --spring.profiles.active=yourprofilein Program Arguments
- Working directory should be set to your application root folder. 
I also don't have separate Active Profiles field highlighted on your screenshot.
This is my working configuration:

We also run our app as :
java -Dproperty=value -jar path/ourapp.jar --spring.profiles.active=ourprofile
Actually, both variants of active profile configuration are correct - see Setting active profile and config location from command line in spring boot
 
    
    
        arghtype
        
- 4,376
- 11
- 45
- 60
- 
                    but I use - java -jar -Dspring.profiles.active=native ddwa-services-app/target/ddwa-services-app-1.0-SNAPSHOT.jar to run form command line, should it not be similar in configuration? – abhi Aug 08 '19 at 00:17
- 
                    @abhi we are using --spring.active.profile in both IDE config and our launch scripts. This may be version specific, we are on Spring Boot 2.0.4 . I've added examples – arghtype Aug 08 '19 at 17:08
