zoukankan      html  css  js  c++  java
  • 如何在myeclipse8.5中使用maven

    今天搞了一天才搞清楚这个问题,一直导入不了mavendependencies,后来发现是

    13-11-23 下午06时47分11秒: Downloading http://mirrors.ibiblio.org/pub/mirrors/maven2/org/codehaus/plexus/plexus-compiler-api/1.5.3/plexus-compiler-api-1.5.3.jar
    13-11-23 下午06时47分11秒: Downloaded http://mirrors.ibiblio.org/pub/mirrors/maven2/org/codehaus/plexus/plexus-compiler-api/1.5.3/plexus-compiler-api-1.5.3.jar

    没有下载完成,maven中没有下载好的jar包会显示一个lastedupdate,需要删除掉重新下载

    以下操作非常重要

    刷新maven配置

        右键工程节点,选择 Maven4MyEclipse - Update Project Configuration

      

    下面附上一个SSH环境的pom.xml文档

    <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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.ibeifeng.course</groupId>
      <artifactId>houserent01</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>war</packaging>
      <name/>
      <description/>
      <dependencies>
      <!-- hibernate核心包 -->
          <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.2.7.Final</version>
        </dependency>
        
        <!-- spring核心包 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.2.4.RELEASE</version>
        </dependency>
        
        <!-- spring持久化使用包 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>3.2.4.RELEASE</version>
        </dependency>
        
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.2.4.RELEASE</version>
        </dependency>
        
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.2.4.RELEASE</version>
        </dependency>
        
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>3.2.4.RELEASE</version>
        </dependency>
        
        <!-- struts2核心包 -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.3.15.3</version>
        </dependency>
        
        <!-- 数据源 -->
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>
        <!-- spring与struts2整合包 -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <version>2.3.15.2</version>
        </dependency>
        
        <!-- mysql驱动包 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.26</version>
        </dependency>
        <!-- 其他核心包 -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        
        <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>jstl</artifactId>
          <version>1.2</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>javax.servlet.jsp</groupId>
          <artifactId>jsp-api</artifactId>
          <version>2.1</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.glassfish</groupId>
          <artifactId>javax.annotation</artifactId>
          <version>3.0.1</version>
        </dependency>
    
        <dependency>
          <groupId>org.glassfish</groupId>
          <artifactId>javax.servlet</artifactId>
          <version>3.0.1</version>
        </dependency>
      </dependencies>
      <build>
        <sourceDirectory>${basedir}/src</sourceDirectory>
        <outputDirectory>${basedir}/WebRoot/WEB-INF/classes</outputDirectory>
        <resources>
          <resource>
            <directory>${basedir}/src</directory>
            <excludes>
              <exclude>**/*.java</exclude>
            </excludes>
          </resource>
        </resources>
        <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1-alpha-1</version>
            <configuration>
              <webappDirectory>${basedir}/WebRoot</webappDirectory>
              <warSourceDirectory>${basedir}/WebRoot</warSourceDirectory>
            </configuration>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0.2</version>
            <configuration>
              <source>1.5</source>
              <target>1.5</target>
            </configuration>
          </plugin>
          
          <plugin> 
              <groupId>org.apache.maven.plugins</groupId> 
              <artifactId>maven-resources-plugin</artifactId> 
            <version>2.4.3</version> 
          </plugin>
          
          <plugin> 
              <groupId>org.apache.maven.plugins</groupId> 
              <artifactId>maven-surefire-plugin</artifactId> 
            <version>2.4.3</version> 
          </plugin>
          
        </plugins>
      </build>
    </project>
  • 相关阅读:
    使用shell脚本备份PostgreSql
    java使用stream做二维数据统计,把List<Map>转换为Map<String,Map<String,Integer>>
    使用idea构建JavaFX项目
    SpringBoot(三) ---- SpringBoot启动加载器
    idea设置大全(三)------变量高亮设置
    延迟初始化占位类模式
    ThreadPoolExecutor构造参数分析
    postgresql插入或批量插入出现冲突时的处理方法
    java函数式接口
    MyBatis(二)批量插入insert语句拼接方式
  • 原文地址:https://www.cnblogs.com/danyubin/p/3439305.html
Copyright © 2011-2022 走看看