Error injecting org apache maven plugin war warmojo

what the console prints, I am trying to run a java web application on netbeans and I do not understand very well why it gives me that error. Downloaded from central: https://repo.maven.apache.org/m...

what the console prints, I am trying to run a java web application on netbeans and I do not understand very well why it gives me that error.

Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.4.4/xstream-1.4.4.jar (483 kB at 33 kB/s)
Error injecting: org.apache.maven.plugin.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
  at org.apache.maven.plugin.war.WarMojo.<init>(Unknown Source)
  while locating org.apache.maven.plugin.war.WarMojo

1 error
    at com.google.inject.internal.InternalProvisionException.toProvisionException (InternalProvisionException.java:226)
    at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1053)
    at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086)
    at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85)

Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.3:war (default-war) on project primera_web: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.3:war failed: Unable to load the mojo ‘war’ in the plugin ‘org.apache.maven.plugins:maven-war-plugin:2.3’ due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: null

realm =    plugin>org.apache.maven.plugins:maven-war-plugin:2.3
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/Users/HP/.m2/repository/org/apache/maven/plugins/maven-war-plugin/2.3/maven-war-plugin-2.3.jar
urls[1] = file:/C:/Users/HP/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar
urls[2] = file:/C:/Users/HP/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar
urls[3] = file:/C:/Users/HP/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar

Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------
: ExceptionInInitializerError: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @5c82031b
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

file 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>primera_web</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>primera_web</name>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>7.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

suggestions to solve the problem ??

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to run my java application but I am facing following error Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

Contents

  1. How This Error Occurs ?
  2. How To Solve Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision Error ?
  3. Solution 1: configure war plugin
  4. Solution 2: Change JDK for your project
  5. Summary

How This Error Occurs ?

I am trying to run my java application but I am facing following error.

Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision, see the following errors:

Error injecting constructor, java.lang.ExceptionInInitializerError at org.apache.maven.plugin.war.WarMojo.<init>(Unknown Source) while locating org.apache.maven.plugin.war.WarMojo

  1. How To Solve Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision Error ?

    To Solve Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision Error Just configure war plugin in your POM.xml. Second one is Just Change your JDK for particular Project. Follow this step. First of all Left-click on your project.Then, Select Properties.now, Select Build.Select compile.Change the JDK to version 14.If you don’t have JDK 14 then The download of the JDK is here.Now, Your issue will be fix.

  2. Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision

    To Solve Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision Error Just configure war plugin in your POM.xml. Second one is Just Change your JDK for particular Project. Follow this step. First of all Left-click on your project.Then, Select Properties.now, Select Build.Select compile.Change the JDK to version 14.If you don’t have JDK 14 then The download of the JDK is here.Now, Your issue will be fix.

Solution 1: configure war plugin

Just configure war plugin in your POM.xml like this.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.2</version>
</plugin>

Solution 2: Change JDK for your project

Just Change your JDK for particular Project. Follow this step.

  1. First of all Left-click on your project.
  2. Then, Select Properties.
  3. now, Select Build.
  4. Select compile.
  5. Change the JDK to version 14.
  6. If you don’t have JDK 14 then The download of the JDK is here.
  7. Now, Your issue will be fix.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

  • java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class

Содержание

  1. [Solved] Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision
  2. How This Error Occurs ?
  3. How To Solve Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision Error ?
  4. Solution 1: configure war plugin
  5. Solution 2: Change JDK for your project
  6. Summary
  7. How to Solve Error Message Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project myapp: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.2:war failed: Unable to load the mojo ‘war’ in the plugin ‘org.apache.maven.plugins:maven-war-plugin:2.2’ due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Cannot access defaults field of Properties when Build and Compile Java Application
  8. Introduction
  9. How to Solve Error Message
  10. Обязательный класс отсутствовал при выполнении org.apache.maven.plugins: maven-war-plugin: 2.1.1: war
  11. 8 ответов
  12. Ошибка при внедрении: org.apache.maven.plugin.war.WarMojo
  13. Не удалось загрузить установку mojo-maven
  14. 9 ответов

[Solved] Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to run my java application but I am facing following error Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How This Error Occurs ?

I am trying to run my java application but I am facing following error.

Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision, see the following errors:

Error injecting constructor, java.lang.ExceptionInInitializerError at org.apache.maven.plugin.war.WarMojo. (Unknown Source) while locating org.apache.maven.plugin.war.WarMojo

How To Solve Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision Error ?

  1. How To Solve Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision Error ?

To Solve Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision Error Just configure war plugin in your POM.xml. Second one is Just Change your JDK for particular Project. Follow this step. First of all Left-click on your project.Then, Select Properties.now, Select Build.Select compile.Change the JDK to version 14.If you don’t have JDK 14 then The download of the JDK is here.Now, Your issue will be fix.
Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision

To Solve Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision Error Just configure war plugin in your POM.xml. Second one is Just Change your JDK for particular Project. Follow this step. First of all Left-click on your project.Then, Select Properties.now, Select Build.Select compile.Change the JDK to version 14.If you don’t have JDK 14 then The download of the JDK is here.Now, Your issue will be fix.

Solution 1: configure war plugin

Just configure war plugin in your POM.xml like this.

Solution 2: Change JDK for your project

Just Change your JDK for particular Project. Follow this step.

  1. First of all Left-click on your project.
  2. Then, Select Properties.
  3. now, Select Build.
  4. Select compile.
  5. Change the JDK to version 14.
  6. If you don’t have JDK 14 then The download of the JDK is here.
  7. Now, Your issue will be fix.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Источник

How to Solve Error Message Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project myapp: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.2:war failed: Unable to load the mojo ‘war’ in the plugin ‘org.apache.maven.plugins:maven-war-plugin:2.2’ due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Cannot access defaults field of Properties when Build and Compile Java Application

Introduction

In this article, there is a specific content for discussing about how to solve an error message appear. That error message appear upon the execution of the compile and build process. The compile and build process is in a Java IDE. Specifically, the process for compiling and building the Java application is using NetBeans IDE. Before going on further, below is the error message which appear in the Output tab of the NetBeans IDE :

What kind of Java application or Java project which is causing the error message ?. Well, the following is part of the ‘pom.xml’ which is become a base description for compiling and building that Java application or Java project :

Actually, there is a specific error message appear in the Output Tab above. The following is that error messaage :

How to Solve Error Message

So, the problem arise upon compiling and building the Java application in NetBeans IDE which in in the failure of loading the plugin ‘org.apache.maven.plugins:maven-war-plugin:2.2’. As in the ‘pom.xml’ file definition, the one which is closely have a relation with the plugin ‘org.apache.maven.plugins:maven-war-plugin:2.2’. Even tough there is no actual definition of it. The only Apache maven plugin exist in the definition is as in the following :

Apparently, it is not enough, since the target of the output is in a ‘war’ file. As it exist in the definifion of the ‘pom.xml’ file as follows :

So, as an assumption, since there is no plugin declaration for building a war file, it will try to use a default maven war plugin with the version of 2.2. Unfortunately, it ends in a failure. In that case, the solution is to provide the definition for maven war plugin as follows :

Источник

Обязательный класс отсутствовал при выполнении org.apache.maven.plugins: maven-war-plugin: 2.1.1: war

Вот мой чистый результат установки -x:

И вот мой pom.xml:

Я попытался удалить репозитории и установить еще раз. Я всегда получал эту ошибку. Похоже, мне нужна помощь. Я думаю, что мой плагин mojo сломан, но я его несколько раз установил. Любые предложения?

8 ответов

Существует ли класс org.apache.maven.shared.filtering.MavenFilteringException в file:/C:/Users/utopcu/.m2/repository/org/apache/maven/shared/maven-filtering/1.0-beta-2/maven-filtering-1.0-beta-2.jar ?

В сообщении об ошибке указано, что это не так. Возможно, JAR был каким-то образом поврежден.

Мне также интересно, откуда приходит версия 1.0-beta-2 ; У меня есть 1.0 на моем диске. Попробуйте версию 2.3 плагина WAR.

Попробуйте удалить папку maven в

/.m2/repository/org/apache/maven и снова создать проект, чтобы загрузить библиотеки maven. Это сработало для меня в последний раз, когда я столкнулся с этим java.lang.NoClassDefFoundError: org/apache/maven/shared/filtering/MavenFilteringException.

Столкнулась с той же проблемой и была решена путем обновления моего Maven с 3.0.4 до 3.1.1. Попробуйте с v3.1.1 или любой более высокой версией, если она доступна

Это должно исправить ошибку

В файле pom.xml вы должны добавить maven-resources-plugin. Удаление

.m2/репозитория не работает всегда.

Теперь создайте свой проект еще раз. Он должен быть успешным!

это случилось со мной также после добавления тега версии, который отсутствовал, в плагин maven-war (не уверен, какая версия использовалась по умолчанию, я изменился до последней версии, 2.6 в моем случае). Мне пришлось стереть .m2/репозиторий, чтобы снова создать сборку.

Я попробовал сначала очистить папку фильтрации maven (в репо), но вместо этого вместо MavenFilterException я получал исключение ArchiverException. Итак, я пришел к выводу, что локальный репозиторий был поврежден (для обновления версии?), И я удалил все.

Это исправило это для меня. Просто очистите свое местное репо.

Источник

Ошибка при внедрении: org.apache.maven.plugin.war.WarMojo

что печатает консоль , я пытаюсь запустить веб-приложение java на netbeans, и я не очень хорошо понимаю, почему это дает мне эту ошибку.

Не удалось выполнить цель org.apache.maven.plugins: maven-war-plugin: 2.3: war (default-war) в проекте primera_web: Execution default-war of goal org.apache.maven.plugins: maven-war-plugin: 2.3: война не удалась: невозможно загрузить mojo ‘war’ в плагин ‘org.apache.maven.plugins: maven-war-plugin: 2.3’ из-за несовместимости API: org.codehaus.plexus.component.repository.exception .ComponentLookupException: нуль

файл pom.xml

предложения по решению проблемы ??

У меня такая же проблема. Я использую выпуск Eclipse от июня 2021 года. Проблема была решена после ручной настройки одного из последних плагинов войны в POM.xml.

Вы можете исправить это, изменив JDK в ваших проектах на JDK 14. Щелкните левой кнопкой мыши по вашему проекту и перейдите в свойства -> построить -> скомпилировать. Измените JDK на версию 14. Если у вас нет JDK 14, вы можете управлять им там, щелкнув «Управление платформами Java». Скачать JDK можно здесь .

Я решил это, просто перейдя в глобальную конфигурацию инструмента Jenkins и изменив путь JDK на /usr/local/Cellar/[email protected]/11.0.10 . Раньше это было /usr/local/Cellar/openjdk/16.0.1 на моем локальном компьютере MAC.

Это была ошибка:

В выпуске Eclipse 2021-06 по умолчанию для JDK будет установлено значение 16. Поэтому изменился на предпочитаемую версию JDK. или настройте JDK по умолчанию для запуска

Источник

Не удалось загрузить установку mojo-maven

Я пытаюсь установить проект maven на работе и получить следующую ошибку. Немного googling показывает других людей с проблемой mojo, но ни один с конкретным Maven-war-plug и MavenFilteringException.

Apache Maven 3.0.3 (r1075438; 2011-02-28 17:31:09+0000)

Maven home: C:devapache-maven-3.0.3bin — . .

версия Java: 1.6.0_19, поставщик: Sun Microsystems Inc.

Java home: c:devjdk1.61.6.0_19jre

локаль по умолчанию: en_GB, кодировка платформы: Cp1252

имя ОС: «windows 7″, версия:» 6.1″, arch:» x86″, семейство:»windows»

9 ответов

когда у меня была эта проблема, казалось, что проблема с моей установкой Maven.

удаление плагина M2Eclipse и удаление .m2 папка на моем диске, а затем переустановка M2Eclipse, казалось, исправить это.

У меня была такая же проблема. Однако после запуска Update Project> проблема решена.

Я просто столкнулся с этой проблемой или что-то очень похожее:

Я только что переименовал некоторые файлы представлений и имел две ошибки, связанные с путем в STS / Eclipse, которые я исправил, но после их исправления рядом с военной линией в файле POM появился красный X.

«Project — > Clean» не помогло.

«Maven — > Update Project» сделал трюк, хотя и очистил сообщение об ошибке.

У меня была та же проблема, и я смог решить эту ошибку в Eclipse, выполнив проект Maven->Update и установив флажок «принудительное обновление снимков/выпусков». Без проверки «принудительного обновления снимков/выпусков», хотя я продолжал получать те же ошибки.

У меня возникла связанная с этим проблема (и закончилась на этом вопросе после googling).

при построении из Eclipse с помощью плагина Maven (запустите как. — >Maven install), это не удалось со следующей ошибкой:

[ошибка] не удалось выполнить цель орг.апаш.знаток.Плагины: maven-resources-plugin: 2.4.1: ресурсы (по умолчанию-ресурсы) в project [имя проекта]: выполнение по умолчанию-ресурсы цели орг.апаш.знаток.Плагины: maven-resources-plugin: 2.4.1: resources failed: не удалось загрузить mojo «resources» в плагин » org.апаш.знаток.Плагины: maven-resources-плагин: 2.4.1′. Отсутствует необходимый класс: org/apache/maven/shared/filtering / MavenFilteringException

построение из командной строки работало нормально, и я заметил, что в этом случае он использовал Maven-resources-plugin версии 2.4.3, а не 2.4.1.

в конце концов я исправил это, удалив и переустановив плагин M2Eclipse (ver. 0.12.1), как предложил Кевин. (Он, казалось, работал, не удаляя )

Я думаю, что повреждение могло произойти, когда я вышел из Eclipse, когда он был в середине «обновления индексов. «.

я исправил эту проблему, выполнив обновление maven и принудительное обновление снимков / выпусков

maven > обновить проект Maven > принудительное обновление снимков / выпусков

У меня была аналогичная проблема, поэтому я удалил только папку Maven в

/.m2 / репозиторий/org/apache / maven и работал для меня.

все библиотеки maven были загружены, и ошибка с MavenFilteringException остановлена.

Я решил эту проблему, под управлением clean install .

Источник

Introduction

This article is actually an additional article. It is very important to add the solution for solving an error in another article. Actually, there is an article How to Solve Error Message Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project myapp: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.2:war failed: Unable to load the mojo ‘war’ in the plugin ‘org.apache.maven.plugins:maven-war-plugin:2.2’ due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Cannot access defaults field of Properties when Build and Compile Java Application. Furthermore, the actual error message which is the focus for further solution is in this article. Below is the actual error message appear :

Error injecting: org.apache.maven.plugin.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:
...
...
...

Basically, the problem exist in the ‘pom.xml’ file. The solution in the previous article mentioned to edit the ‘pom.xml’ as follows :

<?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>
    <groupId>com.github.adminfaces</groupId>
    <artifactId>projectf</artifactId>
    <version>0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>myapp</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>hjojoj
    </properties>
 
    <dependencies>
         <dependency>
             <groupId>javax</groupId>
             <artifactId>javaee-api</artifactId>
             <version>7.0</version>
             <scope>provided</scope>
         </dependency>
    </dependencies>
    <build>
         <resources>
             <resource>
                 <filtering>true</filtering>
                 <directory>src/main/resources</directory>
             </resource>
             <resource>
                 <directory>src/main/docs</directory>
                 <filtering>true</filtering>
             </resource>
             <resource>
                 <directory>src/main/java</directory>
                 <includes>
                     <include>**/*.xml</include>
                     <include>**/*.properties</include>
                 </includes>
             </resource>
         </resources>
         <testResources>
             <testResource>
                  <filtering>true</filtering>
                  <directory>src/test/resources</directory>
             </testResource>
             <testResource>
                  <directory>src/test/java/</directory>
             </testResource>
         </testResources>
         <plugins>
             <plugin>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>3.3</version>
                  <configuration>
                       <source>1.8</source>
                       <target>1.8</target>
                  </configuration>
             </plugin>
         </plugins>
         <finalName>myapp</finalName>
    </build>
    <repositories>
        <repository>
            <id>prime-repo</id>
            <name>PrimeFaces Maven Repository</name>
            <url>https://repository.primefaces.org</url>
            <layout>default</layout>
        </repository>
   </repositories>
</project>

As for the solution, just another snippet code of pom.xml file configuration. The following are those lines of configuration which is adding a plugin as follows :

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
</plugin>

In that case, the complete modification of the ‘pom.xml’ will exist as follows :

<?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>
    <groupId>com.github.adminfaces</groupId>
    <artifactId>projectf</artifactId>
    <version>0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>myapp</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>hjojoj
    </properties>
 
    <dependencies>
         <dependency>
             <groupId>javax</groupId>
             <artifactId>javaee-api</artifactId>
             <version>7.0</version>
             <scope>provided</scope>
         </dependency>
    </dependencies>
    <build>
         <resources>
             <resource>
                 <filtering>true</filtering>
                 <directory>src/main/resources</directory>
             </resource>
             <resource>
                 <directory>src/main/docs</directory>
                 <filtering>true</filtering>
             </resource>
             <resource>
                 <directory>src/main/java</directory>
                 <includes>
                     <include>**/*.xml</include>
                     <include>**/*.properties</include>
                 </includes>
             </resource>
         </resources>
         <testResources>
             <testResource>
                  <filtering>true</filtering>
                  <directory>src/test/resources</directory>
             </testResource>
             <testResource>
                  <directory>src/test/java/</directory>
             </testResource>
         </testResources>
         <plugins>
             <plugin>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>3.3</version>
                  <configuration>
                       <source>1.8</source>
                       <target>1.8</target>
                  </configuration>
             </plugin>
             <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-war-plugin</artifactId>
                  <version>3.3.1</version>
                  </plugin>
         </plugins>
         <finalName>myapp</finalName>
    </build>
    <repositories>
        <repository>
            <id>prime-repo</id>
            <name>PrimeFaces Maven Repository</name>
            <url>https://repository.primefaces.org</url>
            <layout>default</layout>
        </repository>
   </repositories>
</project>

Off course in the dependency section, just add the suitable library package for the Java application. After that, just build and compile it once more. If there are no further error message, the process for building and compiling the Java application will end in a success.

what the console prints, I am trying to run a java web application on netbeans and I do not understand very well why it gives me that error.

Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.4.4/xstream-1.4.4.jar (483 kB at 33 kB/s)
Error injecting: org.apache.maven.plugin.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
  at org.apache.maven.plugin.war.WarMojo.<init>(Unknown Source)
  while locating org.apache.maven.plugin.war.WarMojo

1 error
    at com.google.inject.internal.InternalProvisionException.toProvisionException (InternalProvisionException.java:226)
    at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1053)
    at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086)
    at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85)

Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.3:war (default-war) on project primera_web: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.3:war failed: Unable to load the mojo ‘war’ in the plugin ‘org.apache.maven.plugins:maven-war-plugin:2.3’ due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: null

realm =    plugin>org.apache.maven.plugins:maven-war-plugin:2.3
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/Users/HP/.m2/repository/org/apache/maven/plugins/maven-war-plugin/2.3/maven-war-plugin-2.3.jar
urls[1] = file:/C:/Users/HP/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar
urls[2] = file:/C:/Users/HP/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar
urls[3] = file:/C:/Users/HP/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar

Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------
: ExceptionInInitializerError: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @5c82031b
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

file 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>primera_web</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>primera_web</name>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>7.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

suggestions to solve the problem ??

1) Solution

I had the same problem. I am using Eclipse Jun 2021 release. The problem got resolved after manually configuring one of the recent war plug-ins in POM.xml.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.1</version>
</plugin>
2) Solution

I experienced the same issue after upgrading from JDK 1.8 to JDK 17 and I solved it by upgrading the plugin version.

Before:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
</plugin>

After:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.1</version>
</plugin>
3) Solution

You can fix it by changing the JDK in your projects to JDK 14. Left-click on your project and go to properties -> build -> compile . Change the JDK to version 14. If you don’t have JDK 14, you can manage it there by clicking Manage Java Platforms. The download of the JDK is here.

4) Solution

if you want to deploy the war. what worked for me is both

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.3.1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>

and

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <inherited>true</inherited>
            <version>3.8.1</version>
            <configuration>
                <source>16</source>
                <target>16</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>

Please note the versions.

5) Solution

Your pom.xml like this will work.

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>vysample</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>vysample-1.0-SNAPSHOT</name>
    
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <jakartaee>9.0.0</jakartaee>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-api</artifactId>
            <version>${jakartaee}</version>
            <scope>provided</scope>
        </dependency>
        
    </dependencies>
    
    <build>
        <plugins>            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.2</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>jakarta.platform</groupId>
                                    <artifactId>jakarta.jakartaee-api</artifactId>
                                    <version>${jakartaee}</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Focus at

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.2</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
</plugin>
6) Solution

I have solved this by simply going in the Jenkins global tool configuration and changing the path of JDK to /usr/local/Cellar/[email protected]/11.0.10.
Previously it was /usr/local/Cellar/openjdk/16.0.1 in my local machine MAC.

Click here to see

This was the error :

Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar (431 kB at 529 kB/s)
11:52:49 [WARNING] Error injecting: org.apache.maven.plugin.war.WarMojo
11:52:49 com.google.inject.ProvisionException: Unable to provision, see the following errors:
11:52:49 
11:52:49 1) Error injecting constructor, java.lang.ExceptionInInitializerError: Cannot access defaults field of Properties
11:52:49   at org.apache.maven.plugin.war.WarMojo.<init>(Unknown Source)
7) Solution

Eclipse 2021-06 release by default JDK will be set to 16. So changed to your preferred JDK version. or configure your default JDK to run
enter image description here

maven-war-plugin:3.0.0:war (default-war) @ projectname 
--- [WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo 
com.google.inject.ProvisionException: Unable to provision, 
see the following errors: 1) Error injecting constructor,
java.lang.ExceptionInInitializerError 
at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
8) Solution

I had this exact same issue. After updating the POM file, I needed to delete my .m2/repository folder before running mvn install for the project.

9) Solution

I had the same problems and I resolved changed the version 2.3 to 3.3.1

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-war-plugin</artifactId>
   <version>3.3.1</version>
   <configuration>
      <failOnMissingWebXml>false</failOnMissingWebXml>
   </configuration>
</plugin>

enter image description here
enter image description here

10) Solution

Problem has been resolved by stopping the Tomcat server
sudo systemctl stop tomcat
so as to allow Netbeans to run it. If the server is already running when Netbeans tries to deploy an app Netbeans will display the delopy failed message.

11) Solution

I resolved this error by adding following part in pom.xml

 <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>

        </plugin>

    </plugins>
</build>

apart from that i added maven configuration properties

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

and here is my entire file as following

<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>
<groupId>com.groupId</groupId>
<artifactId>com.artifactId</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
    <!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
    <dependency>
    
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>5.3.0</version>

    </dependency>

</dependencies>


<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>

        </plugin>

    </plugins>
</build>

Comments Section

try deleting full .m2/repository and try again

Update all plugin version you are using… See maven.apache.org/plugins

FYI, current version is 3.3.2.

it worked for me . earlier i was not having this plugin section but after adding it and updating maven, cleaning maven and installing it it worked

Worked for me as well thank you sir

Worked….!!!! :D

not working with 3.8.0

Related Topics
java
netbeans
maven

Mentions
Sanket Singh
Eduardo Guerra Alvarez
Nirbhay Singh
Phillip
Zarcor
Parameshwar
Laurel
Dharman
Ramdane Oualitsen
Vikram
Sangwa Emmanuel

References
stackoverflow.com/questions/66920567/error-injecting-org-apache-maven-plugin-war-warmojo

Issue

I use the newest version of Java -> 16. When I run mvn clean, I am getting Could not initialize class org.apache.maven.plugin.war.util.WebappStructureSerializer error. I read that adding maven-war-plugin can be a solution, but it didn’t work for me. When I run mvn install, the following error occurs:

Error injecting constructor, java.lang.ExceptionInInitializerError:
Cannot access defaults field of Properties at
org.apache.maven.plugin.war.WarMojo.(Unknown Source) while
locating org.apache.maven.plugin.war.WarMojo

How can I solve these problems? Are they caused by the Java version?

<modelVersion>4.0.0</modelVersion>

<groupId>web-programming</groupId>
<artifactId>servlet-demo</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>

<properties>
    <java.version>16</java.version>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <maven.compiler.source>${java.version}</maven.compiler.source>
</properties>

<dependencies>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.1.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <!-- Optional. Allows the app to be run by simply typing mvn jetty:run -->
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.4</version>
            <dependencies>
                <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                    <version>1.2.13</version>
                </dependency>
            </dependencies>
            <configuration>
                <contextPath>/</contextPath>
                <scanIntervalSeconds>10</scanIntervalSeconds>
                <connectors>
                    <connector
                        implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                        <port>9090</port>
                    </connector>
                </connectors>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
        </plugin>
    </plugins>
</build>

Solution

Change the version of the war plugin in your pom.xml and add maven-compiler-plugin according to your jdk version.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.1</version>
</plugin>
<plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.8.1</version>
</plugin>

Answered By — Akshay
Answer Checked By — Terry (JavaFixing Volunteer)

<groupId>com.canreader</groupId>
<artifactId>ecommerce-rest-api</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<description>REST APIs implemented using Spring Boot, in-memory database, embedded Tomcat, Swagger, JsonPath, Hamcrest and MockMVC</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.3.RELEASE</version>
</parent>

<properties>
    <start-class>com.nitsoft.ecommerce.Application</start-class>
</properties>

<dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator</artifactId>
    </dependency>

    <!-- web development, including Tomcat and spring-webmvc -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.velocity</groupId>
        <artifactId>velocity</artifactId>
        <version>1.7</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-websocket</artifactId>
        <version>4.2.5.RELEASE</version>
        <type>jar</type>
    </dependency>

    <!-- Spring security -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

    <!-- spring-data-jpa, spring-orm and Hibernate -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
    
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-messaging</artifactId>
    </dependency>

    <!-- spring-test, hamcrest, ... -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-hibernate4</artifactId>
    </dependency>
    
    <!-- paypal lib-->
    <dependency>
        <groupId>com.paypal.sdk</groupId>
        <artifactId>paypal-core</artifactId>
        <version>1.4.4</version>
    </dependency>
    <dependency>
        <groupId>com.paypal.sdk</groupId>
        <artifactId>merchantsdk</artifactId>
        <version>2.5.106</version>
    </dependency>
    <dependency>
        <groupId>com.paypal.sdk</groupId>
        <artifactId>permissionssdk</artifactId>
        <version>2.3.106</version>
    </dependency>
   
    <!-- super CSV -->
    <dependency>
        <groupId>net.sf.supercsv</groupId>
        <artifactId>super-csv</artifactId>
        <version>2.2.0</version>
    </dependency>
    
    <!-- Amazon S3 Lib -->
    <dependency>
        <artifactId>aws-java</artifactId>
        <groupId>sdk</groupId>
        <version>1.9.7</version>
        <scope>system</scope>
        <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/aws-java-sdk-1.9.7.jar</systemPath>
    </dependency>
    
    <dependency>
        <artifactId>commons</artifactId>
        <groupId>beanutils</groupId>
        <version>1.7</version>
        <scope>system</scope>
        <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/commons-beanutils-1.7.jar</systemPath>
    </dependency>  
    
    <!-- payment -->
    <dependency>
        <groupId>com.stripe</groupId>
        <artifactId>stripe-java</artifactId>
        <version>1.5.1</version>
    </dependency>
    
    <dependency>
        <groupId>commons-cli</groupId>
        <artifactId>commons-cli</artifactId>
        <version>1.1</version>
    </dependency> 
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.4</version>
    </dependency>
    
    <!-- Send Email lib-->
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>
    
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.5</version>
    </dependency>
    
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.4</version>
    </dependency>
    
    <!-- Websocket & notification linraryfrom version 1.0-->    
    <!--<dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.7.4</version>
    </dependency>
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.7.4</version>
    </dependency>  
    <dependency>
        <groupId>javax.websocket</groupId>
        <artifactId>javax.websocket-api</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
    </dependency>-->
    <!-- End Websocket & notification linrary-->  


    <!-- attribute level json comparisons -->
    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path-assert</artifactId>
        <scope>test</scope>
    </dependency>

    <!-- integration with Swagger API doc generation http://goo.gl/J5FQDM -->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.2.2</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.2.2</version>
        <scope>compile</scope>
    </dependency>
    
    <!--<dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <scope>runtime</scope>
    </dependency>-->

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
    
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId><!--$NO-MVN-MAN-VER$ -->
        <version>1.16.18</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.aerogear</groupId>
        <artifactId>aerogear-otp-java</artifactId>
        <version>1.0.0</version>
        <type>jar</type>
    </dependency>
</dependencies>

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <!-- Spring boot support -->
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <addResources>false</addResources>
            </configuration>
        </plugin>
        
        <plugin> 
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-surefire-plugin</artifactId> 
            <version>2.12.4</version> 
            <configuration> 
                <skipTests>true</skipTests> 
            </configuration> 
        </plugin>
        
    </plugins>
</build>
<name>ecommerce-rest-api</name>

Error in Maven project packaging: error injecting constructor, java.lang.exceptionininitializererror: cannot access defaults field of properties     at org.apache.maven.plugin.war.WarMojo.< init>( Unknown Source)     while locating org.apache.maven.plugin.war.WarMojo

When locating org.apache.maven.plugin.war.warmojo, you cannot access org.apache.maven.plugin.war.warmojo. & lt; init>( Default field for the property at unknown source)

I found many methods on the Internet and finally came to the conclusion that it has nothing to do with the code. Just specify the package plug-in version in pom.xml:

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.2</version>
            </plugin>

        </plugins>
    </build>

My JDK version is 16. Change to the latest package plug-in version 3.2.2 to package successfully

Similar Posts:

Понравилась статья? Поделить с друзьями:
  • Error initializing video mode 1024x768 fallout 1
  • Error initializing video mode 1024 768 fallout 2
  • Error initializing steam api
  • Error initializing sdl no available video device
  • Error initializing rpc system dll was not found protocol dll