How can I change the path where spring boot is looking for the source code and resources.
I want to move from src/main to src/server/main.
In pom I put:
<build> <resources> <resource> <directory>src/server/main/resources</directory> </resource> </build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <addResources>true</addResources> <mainClass>ema.Application</mainClass> </configuration> </plugin> </plugins>
Error:
Could not find or load main class ema.Application
Advertisement
Answer
Here is a sample build section of a POM that can be used to configure the directories.
Check line: <sourceDirectory>src/server/main</sourceDirectory> Check line: <directory>src/main/resources</directory>
Below Sample:
<build> <directory>target</directory> <outputDirectory>target/classes</outputDirectory> <finalName>${artifactId}-${version}</finalName> <testOutputDirectory>target/test-classes</testOutputDirectory> <sourceDirectory>src/server/main</sourceDirectory> <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory> <testSourceDirectory>src/test/java</testSourceDirectory> <resources> <resource> <directory>src/main/resources</directory> </resource> </resources> <testResources> <testResource> <directory>src/test/resources</directory> </testResource> </testResources> </build>