windows下ieda或eclipse配置自带maven

eclipse最新安装包自带maven,idea选择安装maven插件后也有默认maven软件,只是在国内还需要添加国内仓库镜像。

在你的用户目录下有  .  开头的隐藏文件m2里面有repository,这是idea或eclipse默认的maven仓库。在m2文件目录下新建settings.xml输入以下内容,修改自maven软件的conf目录下的settings.xml,根据自己电脑修改仓库路径。此外我已经将阿里maven镜像配好。

  <localRepository>C:\Users\你自己电脑\.m2\repository</localRepository> 这里写你的m2文件路径
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they‘re all using the same Maven
 |                 installation). It‘s normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->

  <localRepository>C:\Users\你自己电脑\.m2\repository</localRepository>

  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->

  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->

  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
  </pluginGroups>

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>

  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the ‘id‘ attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
     <mirror>
     <id>alimaven</id>
     <name>aliyun maven</name>
     <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
     <mirrorOf>central</mirrorOf>
     </mirror>
  </mirrors>

  <!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of ‘1.4‘ might activate a profile when the build is executed on a JDK version of ‘1.4.2_07‘.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   |-->
  <profiles>
    <!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as ‘env-dev‘, ‘env-test‘, ‘env-production‘, ‘user-jdcasey‘, ‘user-brett‘, etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id‘s for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->

    <!--
     | Here is another profile, activated by the system property ‘target-env‘ with a value of ‘dev‘,
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set ‘target-env‘ to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile>
      <id>env-dev</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
    -->
  </profiles>

  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

最后在IDE中指定maven的settings.xml位置和仓库位置

eclipse里是window->preference->maven

idea里是setting->maven

原文地址:https://www.cnblogs.com/yifan2015/p/11148524.html

时间: 2024-08-03 10:42:25

windows下ieda或eclipse配置自带maven的相关文章

windows下android NDK 环境配置

0.下载jdk并配置环境变量 下载最新jdk,百度搜索“jdk”就有了.安装完成后,配置环境变量(网上一搜,一堆,我这里仅作简要叙述)  计算机→属性→高级系统设置→高级→环境变量. 系统变量→新建 JAVA_HOME 变量 .变量值填写jdk的安装目录(本人是 D:\Program Files\Java\jdk1.7.0_45) 系统变量→新建 CLASSPATH 变量 变量值填写   .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar(注意最前面有一点)

windows下spark开发环境配置

http://www.cnblogs.com/davidwang456/p/5032766.html windows下spark开发环境配置 --本篇随笔由同事葛同学提供. 特注:windows下开发spark不需要在本地安装hadoop,但是需要winutils.exe.hadoop.dll等文件,前提是你已经安装了eclipse.maven.jdk等软件 spark支持jdk版本建议是1.8及以上,如果开发spark建议将jdk编译版本设置为1.8 我选择的spark是spark-1.4.0

[傻瓜版] Redis在Windows下的开发环境配置步骤

redis默认运行在unix体系下,windows无法直接运行官方版.以下是几种解决方案, 一)Windows移植版.启动速度飞快,优先推荐使用. a) 2.6.12 是稳定版,我用来64位版做开发环境,数个月未发现重要问题.  下载地址: https://github.com/MSOpenTech/redis/tree/2.6/bin/release b) 2.8.4 是3月24发布的最新版,此版本运行时会临时占用内存大小的硬盘空间,下载地址: https://github.com/MSOpe

Windows下Android开发环境配置

最近在配置安卓. 还是拿舍友没带回家的手机.. 自己手机是WP.. 搞了半天搞好了. 叹了口气,要是有人这样教我就好了,少走好多弯路. 废话不说,步骤如下" 一.安装JDK 为啥要安装JDK就不说了吧?java写安卓.. 传送门: http://www.oracle.com/technetwork/java/javase/downloads/index.html 安装完后,配置环境变量: 右击 "我的电脑"->属性->高级->环境变量->系统变量-&g

windows下手动安装和配置xamarin

安装xamarin xamarin官方给出了两种安装方式,自动安装和手动安装. 自动安装比较简单,到http://xamarin.com/download下载xamarininstaller.exe 运行后它会自动下载所需组件.过程还是比较简单的,下面重点说明一下手动安装和配置xamarin. 由于我的系统(win8.1 64位)在运行xamarininstaller.exe时老是报错,给xamarin的支持组发了个邮件,他们回复说还是手动安装吧,并把各个组件的下载链接发了过来.这段时间在网上查

windows下python+flask环境配置详细图文教程

本帖是本人在安装配置python和flask环境时所用到的资源下载及相关的教程进行了整理罗列,来方便后面的人员,省去搜索的时间.如果你在安装配置是存在问题可留言给我. 首先罗列一下python+flask环境所用的一些程序组件的下载地址: 1.python语言环境: http://www.python.org/download/ . 2.setuptools 组件: https://pypi.python.org/pypi/setuptools/0.9.6 . 3.pip 组件: https:/

solr在windows下的安装及配置

solr在windows下的安装及配置 2017-04-28 13:59 122人阅读 评论(0) 收藏 举报 .embody { padding: 10px 10px 10px; margin: 0 -20px; border-bottom: solid 1px #ededed } .embody_b { margin: 0; padding: 10px 0 } .embody .embody_t,.embody .embody_c { display: inline-block; margi

Windows下安装Resin及配置详解与发布应用

关于Resin的好处,网上介绍了一大堆,小编经不住诱惑,决定试用一下.目前Resin的最新版本为:4.0.40,可以从官网直接下载. 1. 将下载下来的Resin包解压开,会看到一大堆的文件,有一些关键的文件,我们需要了解一下. resin-4.0.40 resin安装目录   --conf/resin.properties 配置属性   --conf/resin.xml 配置文件   --conf/licenses/ 许可信息文件   --conf/keys/ openSSL 秘钥   --w

windows下的*.url文件配置

直接指向网页 [InternetShortcut] URL=http://user.qzone.qq.com/2275471603 Modified=F00F43B3A875C601D9 ShowCommand=7 IconIndex=1 IconFile=C:\WINDOWS\SYSTEM\url.dll HotKey=1601 windows下的*.url文件配置,布布扣,bubuko.com