Skip to content
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

jvmArguments is ignored when fork is set to false #7588

Closed
mtyurt opened this issue Dec 7, 2016 · 3 comments
Closed

jvmArguments is ignored when fork is set to false #7588

mtyurt opened this issue Dec 7, 2016 · 3 comments

Comments

@mtyurt
Copy link

mtyurt commented Dec 7, 2016

For following pom file,

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>1.4.2.RELEASE</version>
    <configuration>
        <profiles>
            <profile>dev</profile>
        </profiles>
        <jvmArguments>-Dbase.dir=/Users/mt/dev/ops/maven-test</jvmArguments>
        <fork>false</fork>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

null is returned when I execute System.getProperty("base.dir") in the code. When I remove the fork configuration, the same property is set properly. I have read the documents that the process is forked when jvmArguments or agent is specified, I somehow forgot the fork configuration and it took me quite a time to just remove the line. I expected jvmArguments to override fork configuration, or a simple error that would fail the build is also OK.

@SuperMohit
Copy link

When you do a fork, the process runs on separate JVM instance. Hence ur arguments are no longer visible.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 7, 2016
@mtyurt
Copy link
Author

mtyurt commented Dec 7, 2016

I understand that. But the problem is I could see the jvmArguments configuration in pom.xml, I executed run successfully, in my code I couldn't find any system property I set before.

@philwebb
Copy link
Member

philwebb commented Dec 7, 2016

I expected jvmArguments to override fork configuration, or a simple error that would fail the build is also OK

If you omit <fork> entirely the fact that <jvmArguments> are specified is enough to trigger forking. If you add <fork>false</fork> and <jvmArguments> you should see the following warning in your maven output:

Fork mode disabled, ignoring JVM argument(s) [...]

I'm not sure that there's much more that we could do here.

@philwebb philwebb closed this as completed Dec 7, 2016
@philwebb philwebb removed the status: waiting-for-triage An issue we've not yet triaged label Dec 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants