原因:org.apache.maven.plugin.MojoExecutionException:找不到.git目录!请在您的pom.xml中指定一个有效的[dotGitDirectory]

时间:2018-08-23 17:36:53

标签: spring spring-boot microservices

我从链接https://github.com/sivaprasadreddy/spring-boot-microservices-series中引用代码。当我简单地构建代码时,出现以下错误。

您能否更新任何指针?

[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.2.3:revision (default) on project config-server: .git directory is not found! Please specify a valid [dotGitDirectory] in your pom.xml -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.2.3:revision (default) on project config-server: .git directory is not found! Please specify a valid [dotGitDirectory] in your pom.xml
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    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:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: .git directory is not found! Please specify a valid [dotGitDirectory] in your pom.xml

从目录中列出吗?

$ ls -ltra
total 56
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 users-microservice/
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 recommendation-microservice/
-rw-r--r-- 1 e081155 1049089  2538 Nov 11  2016 README.md
-rw-r--r-- 1 e081155 1049089  4180 Nov 11  2016 pom.xml
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 movies-ui/
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 movie-microservice/
-rw-r--r-- 1 e081155 1049089 11358 Nov 11  2016 LICENSE
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 hystrix-dashboard/
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 docker/
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 discovery-microservice/
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 consul-microservice/
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 config-microservice/
drwxr-xr-x 1 e081155 1049089     0 Nov 11  2016 api-gateway-microservice/
drwxr-xr-x 1 e081155 1049089     0 Aug 24 01:13 ../
drwxr-xr-x 1 e081155 1049089     0 Aug 24 01:15 ./

1 个答案:

答案 0 :(得分:1)

模块config-server在其git-commit-id-plugin中定义了maven插件pom.xml。我不知道它到底是做什么的,但是我以它试图执行一些git命令的名称为前提。

编辑:您的项目文件夹似乎不包含.git文件夹,这意味着它不是git存储库,这会导致maven插件失败。

使用git clone https://github.com/sivaprasadreddy/spring-boot-microservices-series.git

克隆链接的仓库

或使用git init在项目文件夹中初始化新的仓库。