spring-loaded icon indicating copy to clipboard operation
spring-loaded copied to clipboard

maven does not stop tomcat when spring-loaded is used (Mac OS X)

Open lacivert opened this issue 9 years ago • 3 comments

I try getting started examples of Spring. Almost all of them use Spring Boot. I use Eclipse Mars (not STS). Without spring-loaded dependency, everything looks fine. When I put the dependency of spring-loaded into "build", it does not stop tomcat server and doesn't give an error or exception. When I try to use the same port (8080), I see that it is still used so I get BindException:

java.net.BindException: Address already in use

Here is the Maven part -version: 1.2.4.RELEASE-:

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <dependencies>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>springloaded</artifactId>
                    <version>${spring-loaded.version}</version>
                </dependency>
            </dependencies>
        </plugin>

More information about versions:

Java:

java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

Maven:

Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T22:10:27+02:00)
Maven home: /usr/local/Cellar/maven/3.3.1/libexec
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"

lacivert avatar Sep 19 '15 09:09 lacivert

It's because spring-boot-plugin is creating another process which IDE isn't aware of and can't stop. Add false to plugin configuration and add javaagent manually.

ravshansbox avatar Oct 02 '15 12:10 ravshansbox

@ravshansbox thank you, how exactly do we make this configuration?

lacivert avatar Oct 07 '15 17:10 lacivert

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
            <fork>false</fork>
        </configuration>
        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>springloaded</artifactId>
                <version>${spring-loaded.version}</version>
            </dependency>
        </dependencies>
    </plugin>

and load spring-loaded in "old-style", using java-agent.

ravshansbox avatar Oct 08 '15 05:10 ravshansbox