Maven编译无法解析project.parent.basedir

时间:2017-06-12 12:21:23

标签: maven directory parent

我正在使用maven编译apache-hive-2.1.1-src以获得调试原因,我使用-X paremeter打印出调试信息。 但最后,编译失败了:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.3:single (assemble) on project hive-packaging: Failed to create assembly: Error adding file to archive: /data/base/3rd/apache-hive-2.1.1-src/packaging/${project.parent.basedir}/common/src/main/resources/hive-log4j2.properties isn't a file. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.3:single (assemble) on project hive-packaging: Failed to create assembly: Error adding file to archive: /data/base/3rd/apache-hive-2.1.1-src/packaging/${project.parent.basedir}/common/src/main/resources/hive-log4j2.properties isn't a file.
        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.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:497)
        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: Failed to create assembly: Error adding file to archive: /data/base/3rd/apache-hive-2.1.1-src/packaging/${project.parent.basedir}/common/src/main/resources/hive-log4j2.properties isn't a file.
        at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:511)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: org.apache.maven.plugin.assembly.archive.ArchiveCreationException: Error adding file to archive: /data/base/3rd/apache-hive-2.1.1-src/packaging/${project.parent.basedir}/common/src/main/resources/hive-log4j2.properties isn't a file.
        at org.apache.maven.plugin.assembly.archive.phase.FileItemAssemblyPhase.execute(FileItemAssemblyPhase.java:117)
        at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:182)
        at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:452)
        ... 22 more
Caused by: org.codehaus.plexus.archiver.ArchiverException: /data/base/3rd/apache-hive-2.1.1-src/packaging/${project.parent.basedir}/common/src/main/resources/hive-log4j2.properties isn't a file.
        at org.codehaus.plexus.archiver.AbstractArchiver.addFile(AbstractArchiver.java:375)
        at org.apache.maven.plugin.assembly.archive.archiver.AssemblyProxyArchiver.addFile(AssemblyProxyArchiver.java:463)
        at org.apache.maven.plugin.assembly.archive.phase.FileItemAssemblyPhase.execute(FileItemAssemblyPhase.java:113)
        ... 24 more

我检查了pom文件bin.xml,其名称是发生此错误的定义,它是:

<files>
    <file>
      <source>${project.parent.basedir}/common/src/main/resources/hive-log4j2.properties</source>
      <outputDirectory>conf</outputDirectory>
      <destName>hive-log4j2.properties.template</destName>
    </file>
    <file>
      <source>${project.parent.basedir}/ql/src/main/resources/hive-exec-log4j2.properties</source>
      <outputDirectory>conf</outputDirectory>
      <destName>hive-exec-log4j2.properties.template</destName>
    </file>
    <file>
      <source>${project.parent.basedir}/beeline/src/main/resources/beeline-log4j2.properties</source>
      <outputDirectory>conf</outputDirectory>
      <destName>beeline-log4j2.properties.template</destName>
    </file>
    <file>
      <source>${project.parent.basedir}/llap-server/src/main/resources/llap-daemon-log4j2.properties</source>
      <outputDirectory>conf</outputDirectory>
      <destName>llap-daemon-log4j2.properties.template</destName>
    </file>
    <file>
      <source>${project.parent.basedir}/llap-server/src/main/resources/llap-cli-log4j2.properties</source>
      <outputDirectory>conf</outputDirectory>
      <destName>llap-cli-log4j2.properties.template</destName>
    </file>
    <file>
      <source>${project.parent.basedir}/common/src/main/resources/parquet-logging.properties</source>
      <outputDirectory>conf</outputDirectory>
      <destName>parquet-logging.properties</destName>
    </file>
    <file>
      <source>${project.parent.basedir}/hcatalog/README.txt</source>
      <outputDirectory>hcatalog/share/doc/hcatalog</outputDirectory>
    </file>
  </files>

似乎参数${project.parent.basedir}未解析到我的hive主目录/data/base/3rd/apache-hive-2.1.1-src,而是解析为/data/base/3rd/apache-hive-2.1.1-src/packaging/${project.parent.basedir},非常奇怪。实际上,该文件  /data/base/3rd/apache-hive-2.1.1-src/common/src/main/resources/hive-log4j2.properties退出。 有人可以给我一些建议吗?我的maven版本是3.3.9。它与maven组装有什么关系吗?

目录结构是:

hive-2.1.1/
    orc/
    ql/
    other modules/
    packaging/
       src/
          main/
              assembly/
                   bin.xml/ #the pom which throws the error.
                   src.xml/
    pom.xml

你也可以从github查看目录:https://github.com/apache/hive/tree/master/packaging/src/main/assembly

0 个答案:

没有答案