A compilation error occurred at Maven build that indicates that the package does not exist

Source: Internet
Author: User

An error occurred while packaging a command to the MAVEN project could not find the package, the package failed, the error is as follows:



When Maven fails to find a symbol error, the general step is to execute the Eclipse's project---clean-all projects, and then perform MAVEN cleanup to clear the project to see if it solves the problem.

Find some information on the net, roughly summed up as follows:

1. Project coding problem, ensure code unification

The Pom.xml file sets the JDK version, source indicates the supported JDK version, and target specifies the JDK version after the project is packaged.



Also view the JDK version of the project itself, click Project maven Dependency right-->build path->configure build path ..., and then set the JDK version of the project. Guaranteed Code Consistency



2. Pom dependency problem, this dependency may be a dependency without adding a package, if the aggregation project may not add the dependency of other modules, or add the dependencies of other modules, but did not package the dependent modules to the local warehouse, etc.

However, there is no solution to my problem, but the workaround is to add a scope tag to the missing dependencies. This scope is set to provided only when it is compiled and tested, and there is no transitivity


PS: <scope> it primarily manages dependent deployments. Currently <scope> can use 5 values:

* Compile, default, applies to all stages and will be published along with the project.
* provided, similar to compile, expects the JDK, container or user to provide this dependency. such as Servlet.jar.
* Runtime, used only at runtime, such as JDBC driver, for run and test phases.
* Test, used only during testing, to compile and run the test code. Will not be published with the project.
* System, similar to provided, needs to explicitly provide an jar,maven that contains dependencies and does not find it in repository


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.