如何在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>

 

你可能感兴趣的:(MyEclipse)