Eclipse maven例外Java.lang.exceptioninitializererror:无法访问默认属性字段[in thread&quot'worker&quot'in worles-27:building"]

发布于 2025-02-12 13:10:15 字数 1457 浏览 0 评论 0原文

我刚刚将Eclipse更新为版本:2022-06(4.24.0),并且在问题视图中具有下一个例外(在pom.xml文件中):

例外

pom.xml文件包含:

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    ...
  </parent>
  <artifactId>xxxx</artifactId>
  <packaging>war</packaging>
  <properties>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    ...
  </dependencies>
  <repositories>
    <repository>
      ...
    </repository>
  </repositories>
  <build>
    <finalName>xxxx</finalName>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webXml>WebContent\WEB-INF\web.xml</webXml>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

生成maven fifactory时没有问题。

知道如何避免这些错误?

I have just updated eclipse to Version: 2022-06 (4.24.0), and have the next exception in problems view (in pom.xml file):

Exception java.lang.ExceptionInInitializerError: Cannot access defaults field of Properties [in thread "Worker-27: Building"]

The pom.xml file contains:

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    ...
  </parent>
  <artifactId>xxxx</artifactId>
  <packaging>war</packaging>
  <properties>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    ...
  </dependencies>
  <repositories>
    <repository>
      ...
    </repository>
  </repositories>
  <build>
    <finalName>xxxx</finalName>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webXml>WebContent\WEB-INF\web.xml</webXml>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

No problems when generating maven artifactory.

Any idea how to avoid these error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

送君千里 2025-02-19 13:10:15

该解决方案是修改Maven-War-Plugin添加版本3.3.2:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.2</version>
    <configuration>
      <webXml>WebContent\WEB-INF\web.xml</webXml>
      <encoding>UTF-8</encoding>
    </configuration>
  </plugin>

谢谢

the solution is modify maven-war-plugin adding version 3.3.2:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.2</version>
    <configuration>
      <webXml>WebContent\WEB-INF\web.xml</webXml>
      <encoding>UTF-8</encoding>
    </configuration>
  </plugin>

thanks

塔塔猫 2025-02-19 13:10:15

引用普通的香草Maven War插件3.4.0修复了它。无需额外的插件配置。

Reference to plain vanilla Maven War plugin version 3.4.0 fixes it. No extra plugin config needed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文