Create a new MAVEN project in 7.Eclipse

Source: Internet
Author: User
Tags assert

First step: First import the two maven project Hello and hellofriendcreated by the previous command line.

Method: Select the file-->import-->existing MAVEN PROJECTS option to select the corresponding project path to import

Step two: Construct the purpose of the Hello and hellofriend items sequentially

Method: Right-click on the respective project pom.xml file and select the maveninstall command in run as to install the widget into the warehouse

Step three: Create a third maven project through Eclipse . Select the file-->new-->other-->mavenproject option

Fourth step: Create a new file in Src/main/java

Package Cn.toto.maven;

public class Makefriends {

public stringmakefriends (String name) {

hellofriendfriend = new Hellofriend ();

friend.sayhellotofriend ("Litingwei");  

String str= "Hey," +friend.getmyname () + "make a friend.";

System.out.println (str);




Fifth step: Create a new file in Src/test/java

Package Cn.toto.maven;

Import static junit.framework.Assert.assertEquals;

Import static org.junit.assert.*;

Import Org.junit.Test;

public class Makefriendstest {


Public voidtestmakefriends () {

makefriendsmakefriend = new Makefriends ();

String str= makefriend.makefriends ("Tuzuoquan");

assertequals ("Hey,johnmake a friend please.", str);     



Sixth step: Click on the root directory pom.xml add dependencies
















Seventh Step: Right-click pom.xml Select command execution in run as

Create a new MAVEN project in 7.Eclipse

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: 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.