Maven POM.xml file starting with Eclipse error

Asked

Viewed 361 times

-1

Hello, I’m new to the Java world and have been facing several problems to create a Maven project with the eclipse. Below I’ll put the bug, followed by my Maven file and the description of the technologies I’m using and what I’ve tried to do:

Error: Could not initialize class org.apache.Maven.plugin.War.util.Webappstructureserializer (appears as soon as I create the project)

Maven:

<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"
    child.project.url.inherit.append.path="">
    <modelVersion>4.0.0</modelVersion>
    <groupId>br.com</groupId>
    <artifactId>helloWord</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <project.build.sourceEncoding>
            UTF-8
        </project.build.sourceEncoding>
    </properties>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

IDE: Eclipse EE Version: 2021-03 (4.19.0) JRE 1.8 (I also tried using the 16 default of my system) Linux Fedora 32

I didn’t install Maven on my machine, I just installed the eclipse and started using it. I’ve tried to:

Change the version of the JRE; Create another project; Reinstall the eclipse some times; Delete directory . Me2 with Maven plugins to recreate it

I am reading the documentation but I cannot solve it. Can someone please help me?

2 answers

0

Try the following, based on documentation.

In POM.xml inside properties, add:

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

Already in the plugin, just leave:

        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.0</version>
        </plugin>

Would be:

... trecho anterior ...

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
            </plugin>
        </plugins>
    </build>

... trecho seguinte ...

0

To resolve this error add the property below at the end of eclipse.ini and restart the eclipse:

--illegal-access=Permit

Browser other questions tagged

You are not signed in. Login or sign up in order to post.