maven--M2Eclipse
来源:互联网 发布:淘宝店主在哪进货 编辑:程序博客网 时间:2024/06/06 04:32
安装M2Eclipse
第一步:将以下目录中的文件拷贝
第二步:拷贝到eclipse中的dropins目录
第三步:查看eclipse中是否安装成功
第四步:设置maven的安装路径
第五步:设置maven的用户配置
创建MavenFirst工程
第一步:创建maven工程
第二步:next
第三步:next
第四步:
第五步:点击finish,创建maven工程
第六步:创建MavenFirst.java
package com.itheima.maven;/** * Title: MavenFirst */public class MavenFirst {public String sayHello(String name) {return "hello " + name;}}
第七步:创建TestMavenFirst.java
package com.itheima.maven;import org.junit.Test;import junit.framework.Assert;/** * <p>Title: TestMavenFirst</p> */public class TestMavenFirst {@Testpublic void testSayHello(){MavenFirst first = new MavenFirst();String result = first.sayHello("hm19");Assert.assertEquals("hello hm19", result);}}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.itheima.maven</groupId> <artifactId>MavenFirst</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>MavenFirst</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.9</version> <scope>compile</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.9</version> </dependency> </dependencies> <build><plugins><!-- 编译插件,指定编译用的的jdk版本 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.7</source><target>1.7</target><encoding>UTF-8</encoding></configuration></plugin></plugins></build><distributionManagement><repository><id>releases</id><name>Internal Releases</name><url>http://localhost:8080/nexus-2.7.0-06/content/repositories/releases/</url></repository><snapshotRepository><id>snapshots</id><name>Internal Snapshots</name><url>http://localhost:8080/nexus-2.7.0-06/content/repositories/snapshots/</url></snapshotRepository></distributionManagement></project>
第七步:使用eclipse的选项执行maven命令
创建MavenSecond工程
第一步:创建maven工程
第二步:next
第三步:next
第四步:finish,创建maven工程
第五步:创建MavenSecond.java
package com.itheima.maven;/** * <p>Title: MavenSecond</p> * <p>Description: TODO(这里用一句话描述这个类的作用) <p> */public class MavenSecond {public String sayHello(String name){MavenFirst first = new MavenFirst();return first.sayHello(name);}}
第六步:创建TestMavenSecond.java
package com.itheima.maven;import junit.framework.Assert;import org.junit.Test;/** * <p>Title: MavenSecond</p> */public class TestMavenSecond {@Testpublic void sayHello(){MavenSecond second = new MavenSecond();String result = second.sayHello("hm19");Assert.assertEquals("hello hm19", result);}}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.itheima.maven</groupId><artifactId>MavenSecond</artifactId><version>0.0.1-SNAPSHOT</version><dependencies><dependency><groupId>com.itheima.maven</groupId><artifactId>MavenFirst</artifactId><version>0.0.1-SNAPSHOT</version><!-- <optional>true</optional> --></dependency><!-- 第二直接依赖 --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.7</version></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.8</version></dependency></dependencies></project>
0 1
- 【Maven】m2eclipse
- maven--M2Eclipse
- eclipse 安装 maven (m2eclipse)
- Eclipse Maven m2eclipse常见问题
- Eclipse、maven、m2eclipse安装
- Maven及m2eclipse安装
- Maven安装m2eclipse
- Maven插件m2eclipse
- myeclips安装maven插件【m2eclipse】
- 安装eclipse maven插件m2eclipse
- 安装eclipse maven插件m2eclipse
- 安装eclipse maven插件m2eclipse
- Eclipse集成Maven插件 m2eclipse
- 安装eclipse maven插件m2eclipse
- maven(2)-maven/artifactory/m2eclipse安装全过程
- Maven-maven介绍&maven安装配置&创建maven工程&M2Eclipse
- m2eclipse
- Maven的Eclipse插件m2eclipse的问题
- Linux动态库(.so)搜索路径设置方法
- libc++abi.dylib: terminate_handler unexpectedly threw an exception修复
- Android的活动的启动模式
- 2017年1月23号
- Android 利用Gson生成或解析json
- maven--M2Eclipse
- C/S B/S 及WEB工作原理
- 2017年上海“居转户”政策
- Android 开发10个常用工具类
- Ambari2.4build问题
- Fragment的使用
- WPF实战之路
- shiro权限框架详解02-权限理论介绍
- mysql 配置多实例