关于Maven修改默认本地中央仓库路径无效的问题

        关于修改本地中央仓库位置网上很容易找到(修改Maven配置文件settings.xml)。在很久很久以前,我也修改过,也确定修改成功了。但是今天在执行mvn clean install时,我的项目一直被打包安装在默认的本地中央仓库。我仔细检查了你一遍又一遍,最后确定自己的配置没问题。于是想通过命令行的形式查看并修改下本地仓库的位置。这么已查看就发现了问题。 我的 maven 是放在 D:\Java\apache-maven-3.5.3 目录下

        查看maven配置的命令: mvn -X

D:\Java\IdeaProjects\dubbo-interface>mvn -X  
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:0  
5+08:00)  
Maven home: F:\masterSpring\apache-maven-3.5.3\bin\..  
Java version: 1.8.0_181, vendor: Oracle Corporation  
Java home: D:\Java\jdk1.8.0_181\jre  
Default locale: zh_CN, platform encoding: GBK  
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"  
[DEBUG] Created new class realm maven.api  
[DEBUG] Importing foreign packages into class realm maven.api  
[DEBUG]   Imported: javax.annotation.* < plexus.core  
[DEBUG]   Imported: javax.annotation.security.* < plexus.core  
[DEBUG]   Imported: javax.enterprise.inject.* < plexus.core  
[DEBUG]   Imported: javax.enterprise.util.* < plexus.core  
[DEBUG]   Imported: javax.inject.* < plexus.core  
[DEBUG]   Imported: org.apache.maven.* < plexus.core  
[DEBUG]   Imported: org.apache.maven.artifact < plexus.core  
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core  
[DEBUG]   Imported: org.apache.maven.cli < plexus.core  
[DEBUG]   Imported: org.apache.maven.configuration < plexus.core  
[DEBUG]   Imported: org.apache.maven.exception < plexus.core  
[DEBUG]   Imported: org.apache.maven.execution < plexus.core  
[DEBUG]   Imported: org.apache.maven.execution.scope < plexus.core  
[DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core  
[DEBUG]   Imported: org.apache.maven.model < plexus.core  
[DEBUG]   Imported: org.apache.maven.monitor < plexus.core  
[DEBUG]   Imported: org.apache.maven.plugin < plexus.core  
[DEBUG]   Imported: org.apache.maven.profiles < plexus.core  
[DEBUG]   Imported: org.apache.maven.project < plexus.core  
[DEBUG]   Imported: org.apache.maven.reporting < plexus.core  
[DEBUG]   Imported: org.apache.maven.repository < plexus.core  
[DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core  
[DEBUG]   Imported: org.apache.maven.settings < plexus.core  
[DEBUG]   Imported: org.apache.maven.toolchain < plexus.core  
[DEBUG]   Imported: org.apache.maven.usability < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core  
[DEBUG]   Imported: org.codehaus.classworlds < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.* < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.component < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.container < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.context < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.cor  
e  
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < p  
lexus.core  
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.cor  
e  
[DEBUG]   Imported: org.eclipse.aether.* < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.artifact < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.collection < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.deployment < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.graph < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.impl < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.installation < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.internal.impl < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.metadata < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.repository < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.resolution < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.spi < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.transfer < plexus.core  
[DEBUG]   Imported: org.eclipse.aether.version < plexus.core  
[DEBUG]   Imported: org.fusesource.jansi.* < plexus.core  
[DEBUG]   Imported: org.slf4j.* < plexus.core  
[DEBUG]   Imported: org.slf4j.helpers.* < plexus.core  
[DEBUG]   Imported: org.slf4j.spi.* < plexus.core  
[DEBUG] Populating class realm maven.api  
[INFO] Error stacktraces are turned on.  
[DEBUG] Message scheme: color  
[DEBUG] Message styles: debug info warning error success failure strong mojo pro  
ject  
[DEBUG] Reading global settings from F:\masterSpring\apache-maven-3.5.3\bin\..\c  
onf\settings.xml  
[DEBUG] Reading user settings from C:\Users\zcf\.m2\settings.xml  
[DEBUG] Reading global toolchains from F:\masterSpring\apache-maven-3.5.3\bin\..  
\conf\toolchains.xml  
[DEBUG] Reading user toolchains from C:\Users\zcf\.m2\toolchains.xml  
[DEBUG] Using local repository at D:\Java\repo  
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for D:\J  
ava\repo  
[INFO] Scanning for projects...  
[DEBUG] Extension realms for project com.example.demo:dubbo-interface:jar:1.0-SN  
APSHOT: (none)  
[DEBUG] Looking up lifecycle mappings for packaging jar from ClassRealm[plexus.c  
ore, parent: null]  
[WARNING]  
[WARNING] Some problems were encountered while building the effective model for  
com.example.demo:dubbo-interface:jar:1.0-SNAPSHOT  
[WARNING] 'build.plugins.plugin.version' for org.springframework.boot:spring-boo  
t-maven-plugin is missing. @ line 13, column 21  
[WARNING]  
[WARNING] It is highly recommended to fix these problems because they threaten t  
he stability of your build.  
[WARNING]  
[WARNING] For this reason, future Maven versions might no longer support buildin  
g such malformed projects.  
[WARNING]  
[INFO] ------------------------------------------------------------------------  
[INFO] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------  
[INFO] Total time: 0.176 s  
[INFO] Finished at: 2019-11-02T23:51:40+08:00  
[INFO] ------------------------------------------------------------------------  
[ERROR] No goals have been specified for this build. You must specify a valid li  
fecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id  
>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are  
: validate, initialize, generate-sources, process-sources, generate-resources, p  
rocess-resources, compile, process-classes, generate-test-sources, process-test-  
sources, generate-test-resources, process-test-resources, test-compile, process-  
test-classes, test, prepare-package, package, pre-integration-test, integration-  
test, post-integration-test, verify, install, deploy, pre-clean, clean, post-cle  
an, pre-site, site, post-site, site-deploy. -> [Help 1]  
org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specifie  
d for this build. You must specify a valid lifecycle phase or a goal in the form  
at <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-ver  
sion>]:<goal>. Available lifecycle phases are: validate, initialize, generate-so  
urces, process-sources, generate-resources, process-resources, compile, process-  
classes, generate-test-sources, process-test-sources, generate-test-resources, p  
rocess-test-resources, test-compile, process-test-classes, test, prepare-package  
, package, pre-integration-test, integration-test, post-integration-test, verify  
, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site  
-deploy.  
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleSt  
arter.java:94)  
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)  
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)  
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)  
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)  
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)  
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)  
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)  
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.jav  
a:62)  
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessor  
Impl.java:43)  
    at java.lang.reflect.Method.invoke (Method.java:498)  
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launche  
r.java:289)  
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:2  
29)  
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launc  
her.java:415)  
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356  
)  
[ERROR]  
[ERROR]  
[ERROR] For more information about the errors and possible solutions, please rea  
d the following articles:  
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifie  
dException  

        请看第 84 - 89 行,这里加载的是 F:\masterSpring\apache-maven-3.5.3 下的配置文件,而F:\masterSpring\apache-maven-3.5.3根本不是我自己的Maven(不知道哪来的)。

        问题发现了:是使用的 maven 有问题,这个Maven(F:\masterSpring\apache-maven-3.5.3 )我根本没有修改过本地仓库路径,也不知道他是哪来的。

        问题解决:

                方法1:修改F:\masterSpring\apache-maven-3.5.3 这个Maven的配置文件中的默认仓库路径。

                方法2:修改环境变量中的 Maven 路径,改成我自己的Maven D:\java\apache-maven-3.5.3 。

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值