How do you activate Spring's download profile when it comes from IntelliJ?
-
I can't activate Spring loading profile in IntelliJ IDEA.
Java 17
<spring.version>5.3.9</spring.version>
I come in Run ... Edit Configurations... and in VM options,
-Dspring.profiles.active=development
And when the IDE application is launched, it's a mistake:
Error: Could not find or load main class VM Caused by: java.lang.ClassNotFoundException: VM
I've been able to start with this kind of option:
java -jar main-ms-1.2-SNAPSHOT.jar --spring.profiles.active=development
What else do I have to say in IDE that I missed? Cleaned the kees. Rechecked all the structures. Nothing helps. I don't know what the problem is. Other project developers do not have this problem. With the flag -Dspring.profiles.active=development, the annex is launched in IDEA
The bounty expires in 4 days. Answers that other users post to this question are eligible for a +50 reputation bounty. alex is looking for a canonical answer: I need to launch an application from IDEA I can't activate the Spring download profile in IntelliJ IDEA.
Java 17
IntelliJ IDEA 2021.3 Beta (Ultimate Edition)
PERspring.version constituent5.3.9 Verification/spring.version I'm coming in Run ' Edit Configurations... and in VM options I prescribe
-Dspring.profiles.active=development And when you start the application from the IDE, the following errors crashes:
Error: Could not find or load main class VM Caused by: java.lang.ClassNotFoundException: VM At the same time, I managed to launch it manually with this option:
java -jar main-ms-1.2-SNAPSHOT.jar --spring.profiles.active=development What else do I need to register in the IDE that I missed? I cleaned the cache. Rechecked all the settings. Nothing helps. I don't understand what the problem might be. At the same time, other project developers do not have this problem. With the -Spring.profiles.active=development flag, the application is launched in IDEA
profile in Pom.xml This is a shared file Pom.xml, which is at the root of the entire project on microservices.
developmenttrue
development
file:${project.basedir}/. ♪ / ♪ ♪ / ♪ ♪ /maven
${maven.file.path}/releases
${maven.file.path}/snapshotslocalhost:5000
http://${docker.registry.domain}Expand snippet
And this is the file pom.xml the microservice I'm trying to run.com.asvoip.ump
ump-it-lib
1.1-SNAPSHOT
testcom.asvoip.ump
ump-currencymanager-api
1.2-SNAPSHOTcom.asvoip.ump
ump-sqldbclient-lib
1.2-SNAPSHOTcom.asvoip.ump
ump-restapiserver-lib
1.1-SNAPSHOTcom.asvoip.ump
ump-documentation-lib
1.1-SNAPSHOT
io.fabric8<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> </dependency> <dependency> <groupId>co.elastic.logging</groupId> <artifactId>logback-ecs-encoder</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-xml</artifactId> </dependency>
docker-maven-plugin
Expand snippet
enter image description here enter image description hereFile application.yaml
spring.config.activate.on-profile: development
That's where the microservice wrote the designs, and I'm trying to start it.
-
You've missed that IDEA's default loads your own JVM, and her ENV-like thing that's in JAVA_HOME... When you're loaded with the console, then JAVA-HOME comes from the phasing. And he's done enough just in Project Properties adding your java and already playing the project.