Installation maven and configuring the MAC Intellij IDEA

Premise: java environment has been configured

for java maven project management

 

A, maven mounted mac

1, first of all, maven Download http://maven.apache.org/download.cgi

Click into the latest version of maven, but later we found the latest version there are some problems, so I actually downloaded the old version 3.6.1

Click on the bottom of the "archive" hyperlink to download the old version

2, after downloading unzip the folder you want to put into place the path below, such as /Users/zwf/apache-maven-3.6.1

In this case then need to change the .bash_profile, there are two methods, one is to use a direct instruction to save changes in the terminal, the terminal to open a file is saved

 

The first:

① input vim ~ / .bash_profile

② input i edit

export M2_HOME="/Users/zwf/apache-maven-3.6.1"
export PATH="$M2_HOME/bin:$PATH"

③ Input: wq save (: w save file,: wq to save and exit command)

④ configuration files take effect source ~ / .bash_profile

 

The second (which is actually used)

① Input open ~ / .bash_profile

② modified to automatically open the file in

export M2_HOME="/Users/zwf/apache-maven-3.6.1"
export PATH="$M2_HOME/bin:$PATH"

After you click the Save button

③ profile commencement source ~ / .bash_profile

 

After the completion of changes to the configuration file, enter in a terminal mvn -v can see if the installation was successful and the installation path

 

3, setting.xml conf file in the folder maven

If you want to change the file, you can directly replace the cover

 

Two, intelliJ IDEA configuration of the maven

Disposed in preferences-maven

maven home dictionary :( is above /Users/zwf/apache-maven-3.6.1, can be overridden)

user setting file: (setting.xml path, to check override coverage)

local reponsitory: local repository path, from setting.xml in the configuration, generally do not cover

 <! - path to the local warehouse. The default value is $ {user.home} / m2 / repository ->

 <localRepository>usr/local/maven</localRepository>

Configured to save the ok

 

Third, a problem encountered

After configuring failed to import from git, but also can not download resources from maven

提示unable to import maven project:see logs for details

Let go View log View log, click on the help-Show Log in Finder

查看有报错:【Error】com.google.inject.CreationException: Unable to create injector(https://blog.csdn.net/awecoder/article/details/101149948

java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector, see the following errors:

1) No implementation for org.apache.maven.model.path.PathTranslator was bound.
  while locating org.apache.maven.model.path.PathTranslator
    for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.pathTranslator(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350)

2) No implementation for org.apache.maven.model.path.UrlNormalizer was bound.
  while locating org.apache.maven.model.path.UrlNormalizer
    for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.urlNormalizer(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350)

2 errors
	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:543)
	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:159)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
	at com.google.inject.Guice.createInjector(Guice.java:87)
	at com.google.inject.Guice.createInjector(Guice.java:69)
	at com.google.inject.Guice.createInjector(Guice.java:59)
	at org.codehaus.plexus.DefaultPlexusContainer.addComponent(DefaultPlexusContainer.java:344)
	at org.codehaus.plexus.DefaultPlexusContainer.addComponent(DefaultPlexusContainer.java:332)
	at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.customizeComponents(Maven3XServerEmbedder.java:573)
	at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.customize(Maven3XServerEmbedder.java:542)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
......

The reason: Maven3.6.2 version compatibility issues.
Solution: re-download an earlier version Maven3.6.1 and below can be resolved smoothly.

 

Fourth, other supplementary information

1, meaning about the content of the setting xml

https://www.cnblogs.com/yangxia-test/p/4409736.html

 

2, setting.xml Ali cloud in the mirror, if necessary

<mirrors>
    <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
   <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
  </mirrors>

Guess you like

Origin www.cnblogs.com/zhuwf/p/11646617.html