Maven run configuration doesn't pick up active profile while Spring run configuration does










0















My Spring run configuration is just the default with the following the VM options:



-Dspring.profiles.active=local



My Maven run configuration is the defaults with the following in the command line:



spring-boot:run


and the following in VM options:



-Dspring.profiles.active=local



When I run the maven one it doesn't pick up on a profile and instead uses default:



No active profile set, falling back to default profiles: default


With the Spring configuration I have no issues, the problem is with how I need to deploy it, it uses a maven command, so I can't have this failing and I don't really understand why it's happening. There really isn't anything fancy is this projects. It's your basic micro service.



Just in case it's needed. The root 'Application' file only has the following:



@SpringBootApplication
public class MyApplication

public static void main(String args)
SpringApplication.run(MyApplication.class, args);




Link to the Maven run config. It is all defaults outside of what is pictured. https://imgur.com/a/GGiwimQ










share|improve this question
























  • do you have local profile in application.yml or properties ?

    – Deadpool
    Nov 14 '18 at 20:32











  • Nope, I can put it in there but it doesn't fix the problem. Since it ignores the vm options. Every run will just use whatever I entering in the application.properties

    – canpan14
    Nov 14 '18 at 20:38











  • can you update properties file, if you don't have profiles in properties file it will ignore it

    – Deadpool
    Nov 14 '18 at 20:47











  • I added spring.profiles.active=local to application.properties which makes it run in local, but now even if I do -Dspring.profiles.active=test , it still runs in local because it's ignoring the vm options still.

    – canpan14
    Nov 14 '18 at 20:49











  • okay you can do this in two ways, one VM options, second command line args, if you can pass it like command line args --spring.profiles.active=local

    – Deadpool
    Nov 14 '18 at 20:51















0















My Spring run configuration is just the default with the following the VM options:



-Dspring.profiles.active=local



My Maven run configuration is the defaults with the following in the command line:



spring-boot:run


and the following in VM options:



-Dspring.profiles.active=local



When I run the maven one it doesn't pick up on a profile and instead uses default:



No active profile set, falling back to default profiles: default


With the Spring configuration I have no issues, the problem is with how I need to deploy it, it uses a maven command, so I can't have this failing and I don't really understand why it's happening. There really isn't anything fancy is this projects. It's your basic micro service.



Just in case it's needed. The root 'Application' file only has the following:



@SpringBootApplication
public class MyApplication

public static void main(String args)
SpringApplication.run(MyApplication.class, args);




Link to the Maven run config. It is all defaults outside of what is pictured. https://imgur.com/a/GGiwimQ










share|improve this question
























  • do you have local profile in application.yml or properties ?

    – Deadpool
    Nov 14 '18 at 20:32











  • Nope, I can put it in there but it doesn't fix the problem. Since it ignores the vm options. Every run will just use whatever I entering in the application.properties

    – canpan14
    Nov 14 '18 at 20:38











  • can you update properties file, if you don't have profiles in properties file it will ignore it

    – Deadpool
    Nov 14 '18 at 20:47











  • I added spring.profiles.active=local to application.properties which makes it run in local, but now even if I do -Dspring.profiles.active=test , it still runs in local because it's ignoring the vm options still.

    – canpan14
    Nov 14 '18 at 20:49











  • okay you can do this in two ways, one VM options, second command line args, if you can pass it like command line args --spring.profiles.active=local

    – Deadpool
    Nov 14 '18 at 20:51













0












0








0








My Spring run configuration is just the default with the following the VM options:



-Dspring.profiles.active=local



My Maven run configuration is the defaults with the following in the command line:



spring-boot:run


and the following in VM options:



-Dspring.profiles.active=local



When I run the maven one it doesn't pick up on a profile and instead uses default:



No active profile set, falling back to default profiles: default


With the Spring configuration I have no issues, the problem is with how I need to deploy it, it uses a maven command, so I can't have this failing and I don't really understand why it's happening. There really isn't anything fancy is this projects. It's your basic micro service.



Just in case it's needed. The root 'Application' file only has the following:



@SpringBootApplication
public class MyApplication

public static void main(String args)
SpringApplication.run(MyApplication.class, args);




Link to the Maven run config. It is all defaults outside of what is pictured. https://imgur.com/a/GGiwimQ










share|improve this question
















My Spring run configuration is just the default with the following the VM options:



-Dspring.profiles.active=local



My Maven run configuration is the defaults with the following in the command line:



spring-boot:run


and the following in VM options:



-Dspring.profiles.active=local



When I run the maven one it doesn't pick up on a profile and instead uses default:



No active profile set, falling back to default profiles: default


With the Spring configuration I have no issues, the problem is with how I need to deploy it, it uses a maven command, so I can't have this failing and I don't really understand why it's happening. There really isn't anything fancy is this projects. It's your basic micro service.



Just in case it's needed. The root 'Application' file only has the following:



@SpringBootApplication
public class MyApplication

public static void main(String args)
SpringApplication.run(MyApplication.class, args);




Link to the Maven run config. It is all defaults outside of what is pictured. https://imgur.com/a/GGiwimQ







java spring maven intellij-idea






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 21:19







canpan14

















asked Nov 14 '18 at 19:50









canpan14canpan14

546318




546318












  • do you have local profile in application.yml or properties ?

    – Deadpool
    Nov 14 '18 at 20:32











  • Nope, I can put it in there but it doesn't fix the problem. Since it ignores the vm options. Every run will just use whatever I entering in the application.properties

    – canpan14
    Nov 14 '18 at 20:38











  • can you update properties file, if you don't have profiles in properties file it will ignore it

    – Deadpool
    Nov 14 '18 at 20:47











  • I added spring.profiles.active=local to application.properties which makes it run in local, but now even if I do -Dspring.profiles.active=test , it still runs in local because it's ignoring the vm options still.

    – canpan14
    Nov 14 '18 at 20:49











  • okay you can do this in two ways, one VM options, second command line args, if you can pass it like command line args --spring.profiles.active=local

    – Deadpool
    Nov 14 '18 at 20:51

















  • do you have local profile in application.yml or properties ?

    – Deadpool
    Nov 14 '18 at 20:32











  • Nope, I can put it in there but it doesn't fix the problem. Since it ignores the vm options. Every run will just use whatever I entering in the application.properties

    – canpan14
    Nov 14 '18 at 20:38











  • can you update properties file, if you don't have profiles in properties file it will ignore it

    – Deadpool
    Nov 14 '18 at 20:47











  • I added spring.profiles.active=local to application.properties which makes it run in local, but now even if I do -Dspring.profiles.active=test , it still runs in local because it's ignoring the vm options still.

    – canpan14
    Nov 14 '18 at 20:49











  • okay you can do this in two ways, one VM options, second command line args, if you can pass it like command line args --spring.profiles.active=local

    – Deadpool
    Nov 14 '18 at 20:51
















do you have local profile in application.yml or properties ?

– Deadpool
Nov 14 '18 at 20:32





do you have local profile in application.yml or properties ?

– Deadpool
Nov 14 '18 at 20:32













Nope, I can put it in there but it doesn't fix the problem. Since it ignores the vm options. Every run will just use whatever I entering in the application.properties

– canpan14
Nov 14 '18 at 20:38





Nope, I can put it in there but it doesn't fix the problem. Since it ignores the vm options. Every run will just use whatever I entering in the application.properties

– canpan14
Nov 14 '18 at 20:38













can you update properties file, if you don't have profiles in properties file it will ignore it

– Deadpool
Nov 14 '18 at 20:47





can you update properties file, if you don't have profiles in properties file it will ignore it

– Deadpool
Nov 14 '18 at 20:47













I added spring.profiles.active=local to application.properties which makes it run in local, but now even if I do -Dspring.profiles.active=test , it still runs in local because it's ignoring the vm options still.

– canpan14
Nov 14 '18 at 20:49





I added spring.profiles.active=local to application.properties which makes it run in local, but now even if I do -Dspring.profiles.active=test , it still runs in local because it's ignoring the vm options still.

– canpan14
Nov 14 '18 at 20:49













okay you can do this in two ways, one VM options, second command line args, if you can pass it like command line args --spring.profiles.active=local

– Deadpool
Nov 14 '18 at 20:51





okay you can do this in two ways, one VM options, second command line args, if you can pass it like command line args --spring.profiles.active=local

– Deadpool
Nov 14 '18 at 20:51












2 Answers
2






active

oldest

votes


















1














Adding the following to the command line arguments seemed to fix it:



-Drun.jvmArguments=-Dspring.profiles.active=local


Although I understand why it worked it doesn't explain why this happened in the first place. I will update this answer if I ever find out the true reason.






share|improve this answer






























    -1














    create



    application.properties


    file in src/main/resources if it doesnt exist and add



    spring.profiles.active=local





    share|improve this answer























    • wouldn't that make it so no matter how it runs, it runs in local? So I couldn't set it to dev/test through the vm options because the application.properties would override it. I've also never had to do that for another project.

      – canpan14
      Nov 14 '18 at 20:15












    • the vm options override the application.properties file for the same properties

      – A.Mushate
      Nov 14 '18 at 20:19












    • But if the vm options aren't working it will never override it. (And I just tested it, it remains local no matter what I put in the vm options)

      – canpan14
      Nov 14 '18 at 20:30










    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307791%2fmaven-run-configuration-doesnt-pick-up-active-profile-while-spring-run-configur%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Adding the following to the command line arguments seemed to fix it:



    -Drun.jvmArguments=-Dspring.profiles.active=local


    Although I understand why it worked it doesn't explain why this happened in the first place. I will update this answer if I ever find out the true reason.






    share|improve this answer



























      1














      Adding the following to the command line arguments seemed to fix it:



      -Drun.jvmArguments=-Dspring.profiles.active=local


      Although I understand why it worked it doesn't explain why this happened in the first place. I will update this answer if I ever find out the true reason.






      share|improve this answer

























        1












        1








        1







        Adding the following to the command line arguments seemed to fix it:



        -Drun.jvmArguments=-Dspring.profiles.active=local


        Although I understand why it worked it doesn't explain why this happened in the first place. I will update this answer if I ever find out the true reason.






        share|improve this answer













        Adding the following to the command line arguments seemed to fix it:



        -Drun.jvmArguments=-Dspring.profiles.active=local


        Although I understand why it worked it doesn't explain why this happened in the first place. I will update this answer if I ever find out the true reason.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 '18 at 21:13









        canpan14canpan14

        546318




        546318























            -1














            create



            application.properties


            file in src/main/resources if it doesnt exist and add



            spring.profiles.active=local





            share|improve this answer























            • wouldn't that make it so no matter how it runs, it runs in local? So I couldn't set it to dev/test through the vm options because the application.properties would override it. I've also never had to do that for another project.

              – canpan14
              Nov 14 '18 at 20:15












            • the vm options override the application.properties file for the same properties

              – A.Mushate
              Nov 14 '18 at 20:19












            • But if the vm options aren't working it will never override it. (And I just tested it, it remains local no matter what I put in the vm options)

              – canpan14
              Nov 14 '18 at 20:30















            -1














            create



            application.properties


            file in src/main/resources if it doesnt exist and add



            spring.profiles.active=local





            share|improve this answer























            • wouldn't that make it so no matter how it runs, it runs in local? So I couldn't set it to dev/test through the vm options because the application.properties would override it. I've also never had to do that for another project.

              – canpan14
              Nov 14 '18 at 20:15












            • the vm options override the application.properties file for the same properties

              – A.Mushate
              Nov 14 '18 at 20:19












            • But if the vm options aren't working it will never override it. (And I just tested it, it remains local no matter what I put in the vm options)

              – canpan14
              Nov 14 '18 at 20:30













            -1












            -1








            -1







            create



            application.properties


            file in src/main/resources if it doesnt exist and add



            spring.profiles.active=local





            share|improve this answer













            create



            application.properties


            file in src/main/resources if it doesnt exist and add



            spring.profiles.active=local






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 14 '18 at 20:08









            A.MushateA.Mushate

            274




            274












            • wouldn't that make it so no matter how it runs, it runs in local? So I couldn't set it to dev/test through the vm options because the application.properties would override it. I've also never had to do that for another project.

              – canpan14
              Nov 14 '18 at 20:15












            • the vm options override the application.properties file for the same properties

              – A.Mushate
              Nov 14 '18 at 20:19












            • But if the vm options aren't working it will never override it. (And I just tested it, it remains local no matter what I put in the vm options)

              – canpan14
              Nov 14 '18 at 20:30

















            • wouldn't that make it so no matter how it runs, it runs in local? So I couldn't set it to dev/test through the vm options because the application.properties would override it. I've also never had to do that for another project.

              – canpan14
              Nov 14 '18 at 20:15












            • the vm options override the application.properties file for the same properties

              – A.Mushate
              Nov 14 '18 at 20:19












            • But if the vm options aren't working it will never override it. (And I just tested it, it remains local no matter what I put in the vm options)

              – canpan14
              Nov 14 '18 at 20:30
















            wouldn't that make it so no matter how it runs, it runs in local? So I couldn't set it to dev/test through the vm options because the application.properties would override it. I've also never had to do that for another project.

            – canpan14
            Nov 14 '18 at 20:15






            wouldn't that make it so no matter how it runs, it runs in local? So I couldn't set it to dev/test through the vm options because the application.properties would override it. I've also never had to do that for another project.

            – canpan14
            Nov 14 '18 at 20:15














            the vm options override the application.properties file for the same properties

            – A.Mushate
            Nov 14 '18 at 20:19






            the vm options override the application.properties file for the same properties

            – A.Mushate
            Nov 14 '18 at 20:19














            But if the vm options aren't working it will never override it. (And I just tested it, it remains local no matter what I put in the vm options)

            – canpan14
            Nov 14 '18 at 20:30





            But if the vm options aren't working it will never override it. (And I just tested it, it remains local no matter what I put in the vm options)

            – canpan14
            Nov 14 '18 at 20:30

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307791%2fmaven-run-configuration-doesnt-pick-up-active-profile-while-spring-run-configur%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo