How to solve the problem of compiling errors by referencing dependency in pom
This article introduces the relevant knowledge of "how to solve errors in pom citation dependent compilation". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Solution:
1 pay attention to introducing dependent scope configuration
Org.jmockit
Jmockit
1.44
Test
The scope here is test, which doesn't work at compile time, by the way, recall the scope of scope.
Scope:
1.compile: the default value indicates that the dependent project needs to participate in the compilation of the current project, as well as subsequent tests, and the run cycle is also involved, which is a strong dependency. When packing, it usually needs to be included.
2.test: dependent projects only participate in testing-related work, including the compilation and execution of test code, and will not be packaged, such as junit
3.runtime: indicates that the dependent project does not need to be involved in the compilation of the project, but it is required for later testing and run cycles. Compared to compile, it just skips compilation. For example, JDBC driver, suitable for run and test phases
4.provided: you don't have to pack it when you pack it. Other facilities will provide it. In fact, the dependency can theoretically participate in compilation, testing, running, and other cycles. It's equivalent to compile, but exclude is done in the packaging phase.
5.system: in terms of participation, it is the same as provided, but the dependencies are not downloaded from the maven repository, but are taken from the local file system. You need to add attributes of systemPath to define the path
This is the end of the content of "how to solve errors in pom depending on compilation". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!