I am using Spring-Boot v1.3.0.M5 with Maven v3.3.3. I used to be able to run my Spring Boot (boot) application from the console with this command.
mvn clean package spring-boot:run
However, I had to revise my pom.xml to account for the various builds of the environment. In particular, I use Maven profiles to modify boot application properties files. Now, when I run the previously mentioned command, the boot application does not start and complains about the following exception.
Raised: java.lang.NumberFormatException: for input line: "$ {MULTIPART.MAXREQUESTSIZE}"
I have a properties file located in src/main/resources/config/application.properties . And this properties file contains a bunch of key-value pairs that look like this.
multipart.maxFileSize=${multipart.maxFileSize} multipart.maxRequestSize=${multipart.maxRequestSize}
Then in my pom.xml my build is defined as follows.
<build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/*.properties</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <excludes> <exclude>**/*.properties</exclude> </excludes> </resource> </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> <profiles> <profile> <id>env-dev</id> <activation> <activeByDefault>true</activeByDefault> <property> <name>env</name> <value>dev</value> </property> </activation> <properties> <multipart.maxFileSize>250MB</multipart.maxFileSize> <multipart.maxRequestSize>250MB</multipart.maxRequestSize> </properties> </profile> <profile> <id>env-stg</id> <activation> <activeByDefault>false</activeByDefault> <property> <name>env</name> <value>stg</value> </property> </activation> <properties> <multipart.maxFileSize>500MB</multipart.maxFileSize> <multipart.maxRequestSize>500MB</multipart.maxRequestSize> </properties> </profile> <profiles>
I noticed that if I type mvn clean package and look in the jar file, the application.properties file is inside the jar.
However, if I type mvn clean package spring-boot:run , then the applications.properties file is not inside the jar. In fact, nothing under src/main/resources gets into the jar file.
This problem annoys me a bit, because if I want to run my boot application from the command line, I need to take two steps.
mvn clean packagejava -jar ./target/app-0.0.1-SNAPSHOT.jar
Any ideas on what I'm doing wrong?