5 ways to introduce the Java-maven project into the Ueditor picture Upload Component Jar Package class Library

Source: Internet
Author: User
Tags maven central

Recently, obstinately and Baidu's Ueditor components on the bar.
Their own personal website project, it is easy to take care of, the company's projects, and all kinds of problems.
Many projects, the environment is complex, problem-solving methods have to be constantly adjusted.

The project uses MAVEN to manage the jar package, using the Ueditor jar package. Project originally directly using Ueditor source code, compiled after deployment, normal.
Later with the jar package, placed in the Web-inf directory under the Lib package, by default, MAVEN will not add the Lib package to Classpath, need to manually join.
Online maven automatic packaging, will not put Ueditor.jar in the Web_inf directory, causing the program error.


But the MAVEN central repository does not have this jar, and So Yu maven provides a way to rely on the system:
<dependency>
<groupId>com.baidu.ueditor</groupId>
<artifactId>ueditor</artifactId>
<version>1.1.1</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/ueditor-1.1.1.jar</systemPath>
</dependency>

It is possible to run locally, and when the online maven is packaged, there is a problem, suggesting that the jar package cannot be found.

It suddenly occurred to me that the GIT repository was not allowed to commit the jar package, although it was submitted locally, but the online git repository did not have the jar package, so Maven could not find it.
Newly discovered, how good a disposition, unexpectedly because the company inside "The Shielding jar package", causes the abortion, how lets the person regret ~

Online environment to solve this problem, there are 5 ways:
A. Do not configure the jar of system mode, put in the Lib directory, although the final packaged war does not have this jar, but MAVEN packaging will not error.
After deployment, manually copy a jar package in the project's Lib directory.
The advantage of this approach is that it is very simple, and the downside is that if you repackage the deployment, the jar is gone and you have to copy it again.

B. Ask the boss, it is recommended to configure the MAVEN private warehouse, according to MAVEN's standard configuration, get this jar.
I feel really too much trouble, for a jar, to put Maven so complex, is really reluctant to the amount.

This jar is not configured in C.maven, the local environment manually joins the Lib directory to the Classpath, and the online environment in the automated deployment script joins a
"Coyy" Copy Ueditor.jar ~tomcat/.../lib/

Later found that this method still has a problem, if the Tomcat War package has not been extracted by Tomcat, how to move to the Lib directory?
If that project persists, a will be better, but only once.

D. Manually place a ueditor jar in the Maven repository, unlike a private repository, and other projects are in a local repository.
Local Configuration: E:\MavenRepository\com\baidu\ueditor\ueditor\1.1.1\ueditor-1.1.1.jar
Configuration on server:/home/whptp/.m2/repository/com/baidu/ueditor/ueditor/1.1.1/ueditor-1.1.1.jar

This method is suitable for local and server configuration environments and is not suitable for customers.
The customer finally got the war package, if we really gave them the source, the equivalent of their own technical team, this time we tell the technical team to do it.

E. The most primitive method, copy the source code to the SRC directory, compile the deployment of the natural past.

Summary
A. My own personal official website project, originally using jar package, do not configure MAVEN, now changed to system introduction.
Because there is no automated deployment environment on the server, it relies entirely on local packaging and is manually copied to the line. Therefore, you can configure the jar package using Maven's system.

B. The company project, the final adoption of the D method.?


Reference: http://asialee.iteye.com/blog/2100187

Original starting: http://fansunion.cn/article/detail/526.html

Java-maven Project introduces the Ueditor picture Upload Component Jar Package Class Library 5 ways

Related Article

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.