Maven学习笔记
2015-01-26 23:31
218 查看
maven视频教程
http://www.icoolxue.com/album/show/45
1、添加ORACLE驱动包ojdbc,因为 oracle 的jdbc driver不在Maven的central repository中,所以不能和同其他包的方式添加
方案:mvn install:install-file -Dfile=D:/foss/ojdbc14.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.1.0 -Dpackaging=jar
在命令框中执行上面命令,注意ojdbc14.jar包的位置,然后在pom.xml文件中添加如下配置即可
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.1.0</version>
</dependency>
2、在eclipse中执行maven命令,不用添加mvn,例如clean compile
3、使用maven命令部署程序并启动tomcat
方案:在pom.xml文件中添加tomcat插件,配置如下,然后使用clean tomcat6:run命令来部署启动tomcat
<build>
<finalName>student</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- http port -->
<port>8888</port>
<path>/</path>
<uriEncoding>utf-8</uriEncoding>
<ignorePackaging>true</ignorePackaging>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- http port -->
<port>8888</port>
<path>/</path>
<uriEncoding>utf-8</uriEncoding>
<ignorePackaging>true</ignorePackaging>
</configuration>
</plugin>
</plugins>
</build>
4、使用Maven的mvn test执行junit测试,如果报错,可以在target/surefire-reports文件中查看具体的错误信息
5、通过右键单击pom.xml文件选择maven –> add dependency 或者是打开pom.xml文件,选择dependencies –>add 时,搜索不到依赖的jar包
解决方案:1)eclipse菜单 window-> show view –> other –> Maven
2)在打开的窗口里,右键 local repositories –> local repository ,选择 rebuild index
http://www.icoolxue.com/album/show/45
1、添加ORACLE驱动包ojdbc,因为 oracle 的jdbc driver不在Maven的central repository中,所以不能和同其他包的方式添加
方案:mvn install:install-file -Dfile=D:/foss/ojdbc14.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.1.0 -Dpackaging=jar
在命令框中执行上面命令,注意ojdbc14.jar包的位置,然后在pom.xml文件中添加如下配置即可
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.1.0</version>
</dependency>
2、在eclipse中执行maven命令,不用添加mvn,例如clean compile
3、使用maven命令部署程序并启动tomcat
方案:在pom.xml文件中添加tomcat插件,配置如下,然后使用clean tomcat6:run命令来部署启动tomcat
<build>
<finalName>student</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- http port -->
<port>8888</port>
<path>/</path>
<uriEncoding>utf-8</uriEncoding>
<ignorePackaging>true</ignorePackaging>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- http port -->
<port>8888</port>
<path>/</path>
<uriEncoding>utf-8</uriEncoding>
<ignorePackaging>true</ignorePackaging>
</configuration>
</plugin>
</plugins>
</build>
4、使用Maven的mvn test执行junit测试,如果报错,可以在target/surefire-reports文件中查看具体的错误信息
5、通过右键单击pom.xml文件选择maven –> add dependency 或者是打开pom.xml文件,选择dependencies –>add 时,搜索不到依赖的jar包
解决方案:1)eclipse菜单 window-> show view –> other –> Maven
2)在打开的窗口里,右键 local repositories –> local repository ,选择 rebuild index
相关文章推荐
- 学习笔记之maven2学习总结(2,进阶setting.xml与pom.xml)
- Better Builds with Maven学习笔记
- 主题:Maven学习笔记2——向repository上传artifact
- Maven学习笔记 三篇
- maven 学习笔记(三)创建一个较复杂的 eclipse+android+maven 工程
- maven 学习笔记(二)创建一个简单的 eclipse+android+maven 工程
- maven2.0学习笔记[摘]
- Maven学习笔记
- maven3学习笔记3--maven的坐标
- 学习笔记之maven2学习总结(3,maven2在淘宝项目的应用)
- Maven学习笔记(1) 了解什么是Maven
- JUnit学习笔记5---从Maven中运行测试
- Better Build with Maven-学习笔记(1)
- 学习笔记之Maven(一)
- Maven学习笔记
- Better Builds with Maven学习笔记
- maven学习笔记
- maven2学习 新手上路(笔记形式)
- maven3学习笔记1--maven的安装与配置
- maven 学习笔记(一)eclipse+android+maven