A compilation failure was encountered while using the Maven command MVN package to package. Maven prompted the compilation error: the package does not exist JAR package. After checking, it was the use of non-Maven repository jars in the project, i.e., the use of local jars, which caused Maven to compile without finding jars. The solution is to configure POm.XML to add the path to the local JAR so that Maven can identify and find the local JAR at compile time.
The configuration of the Maven-compiler-plugin in POM.xml is referred to below. The focus is on the configuration of the compilerArguments element. To add a native JAR package, just add a line to the compilerArguments element.
< compilerArguments>
< extdirs> ${project.basedir}/src/main/webapp/WEB-INF/lib< /extdirs>
< /compilerArguments>
The configuration of the Maven-compiler-plugin in POM.xml is referred to below. The focus is on the configuration of the compilerArguments element. To add a native JAR package, just add a line to the compilerArguments element.
< compilerArguments>
< extdirs> ${project.basedir}/src/main/webapp/WEB-INF/lib< /extdirs>
< /compilerArguments>
The pom.xml build configuration is referenced below.
<build>
<finalName>test</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
Read More:
- Idea Maven project uses package to package and report error (package does not exist)
- How to select the jar package version for Maven package when the jar package versions referenced by multiple modules are inconsistent
- Does the version of idea2020.1 import mybayis jar package or report an error? Error: (4,28) Java: package org.apache.ibatis.io does not exist
- package xxx does not exist cannot find symbol
- Idea error: (4, 28) Java: package com.alibaba.fastjson does not exist
- package R does not exist
- Error: package android.support.annotation Does not exist
- Maven’s jar package conflict; Maven’s introduction
- Idea error: (4, 46) Java: package org.springframework.boot . autoconfigure does not exist problem solving
- The jar package download of Maven project appears (could not transfer artifact. Org mybatis:mybatis )
- Update project manually_ Solution of too large jar package in springboot
- Zip to decompress the jar package, like the add file in the jar package
- Tomcat was unable to load Maven’s jar package
- What to do when idea Maven package appears could not find artifact xxxxx!
- When Maven hits the jar package, an error is reported when executing install, and the symbol cannot be found in a line
- Research on Maven management of Java project pom.xml The jar package error is reported, but the project is running normally
- Julia install and use the extension package package (ERROR: UndefVarError: Pkg not defined)
- U disk installation Linux system could not boot, / dev / root does not exist and the identified hard disk space is not available
- Solution of error report in springboot Maven package websocket
- Mybatis idea environment integration jar package