I am using Java 21, Eclipse 25 and tried to create a Spring Boot application which is showing red marks in Application.java
file and in pom.xml
. I downloaded this Spring Boot project from Spring Initializr, i.e. http://start.spring.io. It fails to compile and run.
Full compilation error log:
[INFO] Scanning for projects...
[INFO]
[INFO] [1m-----------------< [0;36mcom.rishabh:SpringBootFundamentals[0;1m >-----------------[m
[INFO] [1mBuilding SpringBootFundamentals 0.0.1-SNAPSHOT[m
[INFO] from pom.xml
[INFO] [1m--------------------------------[ jar ]---------------------------------[m
[INFO]
[INFO] [1m>>> [0;32mspring-boot:3.5.0:build-image[m [1m(default-cli)[0;1m > [0;1mpackage[m @ [36mSpringBootFundamentals[0;1m >>>[m
[INFO]
[INFO] [1m--- [0;32mresources:3.3.1:resources[m [1m(default-resources)[m @ [36mSpringBootFundamentals[0;1m ---[m
[INFO] Copying 1 resource from src\main\resources to target\classes
[INFO] Copying 0 resource from src\main\resources to target\classes
[INFO]
[INFO] [1m--- [0;32mcompiler:3.14.0:compile[m [1m(default-compile)[m @ [36mSpringBootFundamentals[0;1m ---[m
[INFO] Nothing to compile - all classes are up to date.
[INFO]
[INFO] [1m--- [0;32mresources:3.3.1:testResources[m [1m(default-testResources)[m @ [36mSpringBootFundamentals[0;1m ---[m
[INFO] skip non existing resourceDirectory C:\Users\ashish\Downloads\SpringBootFundamentals\SpringBootFundamentals\src\test\resources
[INFO]
[INFO] [1m--- [0;32mcompiler:3.14.0:testCompile[m [1m(default-testCompile)[m @ [36mSpringBootFundamentals[0;1m ---[m
[INFO] Nothing to compile - all classes are up to date.
[INFO]
[INFO] [1m--- [0;32msurefire:3.5.3:test[m [1m(default-test)[m @ [36mSpringBootFundamentals[0;1m ---[m
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.rishabh.SpringBootFundamentals.[1mSpringBootFundamentalsApplicationTests[m
12:41:29.775 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils -- Could not detect default configuration classes for test class [com.rishabh.SpringBootFundamentals.SpringBootFundamentalsApplicationTests]: SpringBootFundamentalsApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
12:41:30.387 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper -- Found @SpringBootConfiguration com.rishabh.SpringBootFundamentals.SpringBootFundamentalsApplication for test class com.rishabh.SpringBootFundamentals.SpringBootFundamentalsApplicationTests
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.5.0)
2025-05-29T12:41:33.706+05:30 INFO 10728 --- [SpringBootFundamentals] [ main] S.SpringBootFundamentalsApplicationTests : Starting SpringBootFundamentalsApplicationTests using Java 21.0.4 with PID 10728 (started by rishabh in C:\Users\ashish\Downloads\SpringBootFundamentals\SpringBootFundamentals)
2025-05-29T12:41:33.710+05:30 INFO 10728 --- [SpringBootFundamentals] [ main] S.SpringBootFundamentalsApplicationTests : No active profile set, falling back to 1 default profile: "default"
2025-05-29T12:41:39.021+05:30 INFO 10728 --- [SpringBootFundamentals] [ main] S.SpringBootFundamentalsApplicationTests : Started SpringBootFundamentalsApplicationTests in 7.128 seconds (process running for 12.721)
Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build as described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3
WARNING: A Java agent has been loaded dynamically (C:\Users\ashish\.m2\repository\net\bytebuddy\byte-buddy-agent\1.17.5\byte-buddy-agent-1.17.5.jar)
WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
WARNING: Dynamic loading of agents will be disallowed by default in a future release
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[INFO] [1;32mTests run: [0;1;32m1[m, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 16.35 s -- in com.rishabh.SpringBootFundamentals.[1mSpringBootFundamentalsApplicationTests[m
[INFO]
[INFO] Results:
[INFO]
[INFO] [1;32mTests run: 1, Failures: 0, Errors: 0, Skipped: 0[m
[INFO]
[INFO]
[INFO] [1m--- [0;32mjar:3.4.2:jar[m [1m(default-jar)[m @ [36mSpringBootFundamentals[0;1m ---[m
[INFO] Building jar: C:\Users\ashish\Downloads\SpringBootFundamentals\SpringBootFundamentals\target\SpringBootFundamentals-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] [1m--- [0;32mspring-boot:3.5.0:repackage[m [1m(repackage)[m @ [36mSpringBootFundamentals[0;1m ---[m
[INFO] Replacing main artifact C:\Users\ashish\Downloads\SpringBootFundamentals\SpringBootFundamentals\target\SpringBootFundamentals-0.0.1-SNAPSHOT.jar with repackaged archive, adding nested dependencies in BOOT-INF/.
[INFO] The original artifact has been renamed to C:\Users\ashish\Downloads\SpringBootFundamentals\SpringBootFundamentals\target\SpringBootFundamentals-0.0.1-SNAPSHOT.jar.original
[INFO]
[INFO] [1m<<< [0;32mspring-boot:3.5.0:build-image[m [1m(default-cli)[0;1m < [0;1mpackage[m @ [36mSpringBootFundamentals[0;1m <<<[m
[INFO]
[INFO]
[INFO] [1m--- [0;32mspring-boot:3.5.0:build-image[m [1m(default-cli)[m @ [36mSpringBootFundamentals[0;1m ---[m
[INFO] [1m------------------------------------------------------------------------[m
[INFO] [1;31mBUILD FAILURE[m
[INFO] [1m------------------------------------------------------------------------[m
[INFO] Total time: 35.279 s
[INFO] Finished at: 2025-05-29T12:41:53+05:30
[INFO] [1m------------------------------------------------------------------------[m
[ERROR] Failed to execute goal [32morg.springframework.boot:spring-boot-maven-plugin:3.5.0:build-image[m [1m(default-cli)[m on project [36mSpringBootFundamentals[m: [1;31mExecution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.5.0:build-image failed: 'value' [SpringBootFundamentals] must be a parsable name in the form '[domainHost:port/][path/]name' (with 'path' and 'name' containing only [a-z0-9][.][_][-])[m -> [1m[Help 1][m
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the [1m-e[m switch.
[ERROR] Re-run Maven using the [1m-X[m switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
My pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.rishabh</groupId>
<artifactId>SpringBootFundamentals</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringBootFundamentals</name>
<description>SpringBootFundamentals project</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>21</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
My Application.java
file (unable to recognize annotation @SpringBootApplication here):
There is an issue with your own artifact's name. It must match the REGEX pattern as shown in the error output:
<groupId>com.rishabh</groupId>
<artifactId>spring-boot-fundamentals</artifactId>
<version>0.0.1-SNAPSHOT</version>