Adding classpath to SpringBoot command line start when using maven-spring-boot-plugin

后端 未结 2 1461
别跟我提以往
别跟我提以往 2021-01-13 07:17

I\'m trying to add a classpath to when I run my spring boot application, which is run with the following command

mvn spring-boot:run

I\'m c

2条回答
  •  半阙折子戏
    2021-01-13 07:51

    The Spring Boot Maven Plugin spawns a JVM which will, by default, include whatever your project says should be on the classpath e.g.

    • ${project.build.outputDirectory} this includes classes and resources
    • dependencies declared in your project's POM

    If you need to add things to this classpath, the plugin offers the following:

    • addResources
    • folders
    • useTestClasspath

    For example, if you want to add this folder: /this/that/theother to the classpath then you would configure the spring-boot plugin as follows:

    
        org.springframework.boot
        spring-boot-maven-plugin
        
            
                
                    /this/that/theother
                
            
        
    
    

    With that configuration in place, if you invoke mvn spring-boot:run -X you'll see that the additional folder is included on the front of the classpath ...

    [DEBUG] Classpath for forked process: /this/that/theother:...

提交回复
热议问题