Solution

  1. 没有.git文件夹 -> 给你copy个现成的git项目的.git文件夹!
    mvn eclipse:eclipse生成工程文件时报错dotGitDirectory不存在
  2. 通过eclipse导入工程
  3. 发现maven dependence还是没导入,原因是新开了个workspace,maven配置没有指向本地仓库。
    mvn eclipse:eclipse生成工程文件时报错dotGitDirectory不存在
  4. 大功告成,可以好好看代码了。
    mvn eclipse:eclipse生成工程文件时报错dotGitDirectory不存在

Reference
https://stackoverflow.com/questions/31173467/maven-cannot-find-git-dotgitdirectory

Issue Description
[DEBUG] Created new class realm plugin>pl.project13.maven:git-commit-id-plugin:2.2.3
[DEBUG] Importing foreign packages into class realm plugin>pl.project13.maven:git-commit-id-plugin:2.2.3
[DEBUG] Imported: < project>com.floragunn:search-guard-6:6.x-HEAD-SNAPSHOT
[DEBUG] Populating class realm plugin>pl.project13.maven:git-commit-id-plugin:2.2.3
[DEBUG] Included: pl.project13.maven:git-commit-id-plugin:jar:2.2.3
[DEBUG] Included: javax.enterprise:cdi-api:jar:1.0
[DEBUG] Included: javax.annotation:jsr250-api:jar:1.0
[DEBUG] Included: org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0
[DEBUG] Included: aopalliance:aopalliance:jar:1.0
[DEBUG] Included: org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.0.0.M5
[DEBUG] Included: org.eclipse.aether:aether-util:jar:0.9.0.M2
[DEBUG] Included: org.codehaus.plexus:plexus-interpolation:jar:1.19
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.0.15
[DEBUG] Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG] Included: org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3
[DEBUG] Included: org.sonatype.plexus:plexus-cipher:jar:1.4
[DEBUG] Included: com.fasterxml.jackson.core:jackson-databind:jar:2.6.4
[DEBUG] Included: com.fasterxml.jackson.core:jackson-annotations:jar:2.6.0
[DEBUG] Included: com.fasterxml.jackson.core:jackson-core:jar:2.6.4
[DEBUG] Included: joda-time:joda-time:jar:2.9.1
[DEBUG] Included: com.google.guava:guava:jar:19.0
[DEBUG] Included: com.intellij:annotations:jar:12.0
[DEBUG] Included: org.eclipse.jgit:org.eclipse.jgit:jar:4.5.2.201704071617-r
[DEBUG] Included: com.jcraft:jsch:jar:0.1.53
[DEBUG] Included: com.googlecode.javaewah:JavaEWAH:jar:0.7.9
[DEBUG] Included: org.apache.httpcomponents:httpclient:jar:4.3.6
[DEBUG] Included: org.apache.httpcomponents:httpcore:jar:4.3.3
[DEBUG] Included: commons-logging:commons-logging:jar:1.1.3
[DEBUG] Included: commons-codec:commons-codec:jar:1.6
[DEBUG] Configuring mojo pl.project13.maven:git-commit-id-plugin:2.2.3:revision from plugin realm ClassRealm[plugin>pl.project13.maven:git-commit-id-plugin:2.2.3, parent: [email protected]]
[DEBUG] Configuring mojo ‘pl.project13.maven:git-commit-id-plugin:2.2.3:revision’ with basic configurator -->
[DEBUG] (s) abbrevLength = 7
[DEBUG] (s) commitIdGenerationMode = flat
[DEBUG] (s) dateFormat = yyyy-MM-dd’T’HH:mm:ssZ
[DEBUG] (s) dotGitDirectory = D:\Users\search-guard-master.git
[DEBUG] (s) excludeProperties = [git.build.host, git.commit.user., git.build.user.]
[DEBUG] (f) failOnNoGitDirectory = true
[DEBUG] (f) failOnUnableToExtractRepoInfo = true
[DEBUG] (s) format = properties
[DEBUG] (f) generateGitPropertiesFile = true
[DEBUG] (f) generateGitPropertiesFilename = D:\Users\search-guard-master\target\classes/git.properties
[DEBUG] (f) injectAllReactorProjects = false
[DEBUG] (s) prefix = git
[DEBUG] (f) project = MavenProject: com.floragunn:search-guard-6:6.x-HEAD-SNAPSHOT @ D:\Users\search-guard-master\pom.xml
[DEBUG] (f) reactorProjects = [MavenProject: com.floragunn:search-guard-6:6.x-HEAD-SNAPSHOT @ D:\Users\search-guard-master\pom.xml]
[DEBUG] (f) runOnlyOnce = false
[DEBUG] (f) session = [email protected]
[DEBUG] (f) skip = false
[DEBUG] (f) skipPoms = true
[DEBUG] (f) useNativeGit = false
[DEBUG] (s) verbose = false
[DEBUG] – end configuration –
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.162 s
[INFO] Finished at: 2018-10-09T16:57:47+08:00
[INFO] Final Memory: 22M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.2.3:revision (get-the-git-infos) on project search-guard-6: .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 (get-the-git-infos) on project search-guard-6: .git directory is not found! Please specify a valid [dotGitDirectory] in your pom.xml
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:352)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:197)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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
at pl.project13.maven.git.GitCommitIdMojo.execute(GitCommitIdMojo.java:393)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
… 24 more
Caused by: pl.project13.maven.git.GitCommitIdExecutionException: .git directory is not found! Please specify a valid [dotGitDirectory] in your pom.xml
at pl.project13.maven.git.GitCommitIdMojo.execute(GitCommitIdMojo.java:345)
… 26 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

相关文章: