Maven学习笔记

maven视频教程



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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值