Maven的安装

1.解压maven包

2.创建maven目录(注意路径中不要有中文)里面包含maven和相对应的本地仓库

3.修改maven中的中的settings.xml配置文件,修改该节点  <localRepository>E:/maven/repository</localRepository>

将路径指向解压后的本地仓库路径

4. 配置maven的环境变量

将变量加入到path路径下

5.设置IDEA的maven路径

6.创建maven项目

IDEA.exe中,File-->project-->maven

7.配置文件

<?xml version="1.0" encoding="UTF-8"?>
<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.beicai</groupId> <!--创建maven项目的时候-->
<artifactId>scala_1608c</artifactId><!--创建maven项目的时候-->
    <version>1.0-SNAPSHOT</version>

<properties>
<encoding>UTF-8</encoding>
<scala.version>2.10.6</scala.version>
</properties>

<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
</dependencies>

<build>
<sourceDirectory>src/main/scala</sourceDirectory><!--java和scala看自己-->
<testSourceDirectory>src/test/scala</testSourceDirectory><!--java和scala看自己-->

<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass></mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

 有报错的地方,把鼠标放在报错的地方,按Alt+回车,会自动下载

 

8.创建maven项目中碰到的错

  找不到maven

  

  

posted @ 2017-05-12 17:14  李晟男  阅读(252)  评论(0编辑  收藏  举报