0

I am having problem when importing existing maven projects into Eclipse. Every time i get the following error:

Could not get the value for parameter encoding for plugin execution default-resources

Plugin org.apache.maven.plugins:maven-resources-plugin:3.1.0 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-resources-plugin:jar:3.1.0 -> org.apache.maven.shared:maven-filtering:jar:3.1.1 -> org.apache.maven.shared:maven-shared-utils:jar:3.0.0

As the project imports thru, the only error that shows up is in pom.xl on parent tag.

I have tried to completely uninstall Java, Maven and Eclipse. None of this worked for me.

This is how the pom.xl file looks like.

<?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>2.1.8.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>Pr1.pr1</groupId>
<artifactId>pr1p</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>pr1p</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>11</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <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>

UPDATE: After reinstalling Maven once again, repairing wrongly defined system variables and rebooting PC, it just works. I am unsure which of these fixed the problem, most likely the reinstallation.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Airs
  • 1
  • 3
  • Please check to build on plain command line.... – khmarbaise Jan 02 '21 at 21:38
  • UPDATE: After reinstalling Maven once again, repairing wrongly defined system variables and rebooting PC, it just works. I am unsure which of these fixed the problem, most likely the reinstalation. – Airs Jan 03 '21 at 00:31

1 Answers1

0

I created a Maven project with your POM here. I added to it:

        ...
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
            <mainClass>igb.so.DemoApplication</mainClass>
        </configuration>
        ...

$ mvn clean install

...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.707 s
[INFO] Finished at: 2021-01-02T21:26:35+01:00
[INFO] ------------------------------------------------------------------------

And, BTW, for the Maven Compiler plugin it's:

    <properties>
        ...
        <maven.compiler.release>11</maven.compiler.release>
    </properties>

I added that, too.

Re java.version:

API Note:

Changing a standard system property may have unpredictable results unless otherwise specified.

The resources-plugin ist the first in the default build lifecycle. Are there special <servers>/<mirrors> declarations in your settings.xml?

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
  • I don't think this will make any difference. Actual error is `Failed to collect dependencies` so most likely misconfigured settings.xml – rkosegi Jan 02 '21 at 19:27