Skip to content

Document that -Dspring.profiles.active should not be used to run an app with Maven #10926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mvitz opened this issue Nov 4, 2017 · 8 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@mvitz
Copy link
Contributor

mvitz commented Nov 4, 2017

Running my application via ./mvnw spring-boot:run -Dspring.profiles.active=dev works and activates the dev-Profile. However if I add spring-boot-devtools the specified profile is not used any longer.

An example showing this behaviour can be found at https://github.com/mvitz/maven-spring-boot-devtools-Dspring.profiles.active-bug

Best outcome would be that this will be fixed, if not possible it should at least be documented.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 4, 2017
@wilkinsona
Copy link
Member

As explained in the documentation, adding DevTools causes run to fork a separate JVM. You are passing the system property into Maven’s JVM so it isn’t picked up by the forked JVM used by the application. You should use run.profiles or run.jvmArguments instead.

@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 4, 2017
@mvitz
Copy link
Contributor Author

mvitz commented Nov 4, 2017

Thanks for your fast response and explanation.

Imho this could be made a little bit clearer in the documentation as not everyone is aware that spawning own processes implies that this JVM-Argument is swallowed but thats up to you.

Just as an explaination why I opened this:

Some members of a team I know used -Dspring.profiles.active in their run scripts and after someone added DevTools this scripts were broken and they refused to use DevTools. My hope was that having this behaviour documented clearer would have lead to fewer frustration.

Have a nice weekend & regards
Michael

@wilkinsona
Copy link
Member

Ok, let’s see what we can do. Perhaps you or someone on your team could propose something that would have made the documentation clearer?

@waynerogers

This comment has been minimized.

@snicoll

This comment has been minimized.

@snicoll
Copy link
Member

snicoll commented May 21, 2019

There is also the idea of logging something to indicate that the JVM has been forked and variables set on the maven process won't be transmitted. I've shared some reservation on #16819 and flagging for team attention to see what the rest of the team thinks.

@snicoll snicoll added the for: team-attention An issue we'd like other members of the team to review label May 21, 2019
@drahkrub
Copy link

There is also the idea of logging something to indicate that the JVM has been forked

Logging is better than nothing, but I would prefer something on screen (if there is enough space for ascii art banners, then a one-liner should fit there as well ;-)).

@snicoll snicoll removed the for: team-attention An issue we'd like other members of the team to review label May 22, 2019
@snicoll
Copy link
Member

snicoll commented May 22, 2019

We've decided to revisit the documentation and change the default value of the fork property, see #16945

@snicoll snicoll self-assigned this May 23, 2019
@snicoll snicoll changed the title DevTools swallow -Dspring.profiles.active when run via Maven Plugin Document that -Dspring.profiles.active should not be used to run an app with Maven Jun 3, 2019
@snicoll snicoll modified the milestones: 2.2.x, 2.2.0.M4 Jun 3, 2019
@snicoll snicoll closed this as completed in 8beb6c1 Jun 3, 2019
wilkinsona pushed a commit to wilkinsona/spring-boot that referenced this issue Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

7 participants