Cannot resolve ${project.parent.basedir} in maven.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cannot resolve ${project.parent.basedir} in maven.

wuchang
I am using maven to compile apache-hive-2.1.1-src for debug reason ,I use -X paremeter to print out the debug information. but finally , the compilation failed:

[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
I have checked the pom file bin.xml whose name is definition where this error happened,it is :

<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>
it seems that the parameter ${project.parent.basedir} is not resolved to my hive home directory /data/base/3rd/apache-hive-2.1.1-src,instead it is resolved to /data/base/3rd/apache-hive-2.1.1-src/packaging/${project.parent.basedir},very strange.

Actually , the file /data/base/3rd/apache-hive-2.1.1-src/common/src/main/resources/hive-log4j2.properties exits. Anyone could give me some suggestions?

Is ${project.parent.basedir} a maven built-in variable?

My maven version is 3.3.9.Does it have anything to do with maven assembly?

The directory structure is :

hive-2.1.1/
    orc/
    ql/
    other modules/
    packaging/
       src/
          main/
              assembly/
                   bin.xml/ #the pom which throws the error.
                   src.xml/
    pom.xml
you can also check the hive source code  from github :https://github.com/apache/hive/tree/master/packaging/src/main/assembly <https://github.com/apache/hive/tree/master/packaging/src/main/assembly>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot resolve ${project.parent.basedir} in maven.

stephenconnolly
On 13 June 2017 at 07:47, wuchang <[hidden email]> wrote:

> I am using maven to compile apache-hive-2.1.1-src for debug reason ,I use
> -X paremeter to print out the debug information. but finally , the
> compilation failed:
>
> [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
> I have checked the pom file bin.xml whose name is definition where this
> error happened,it is :
>
> <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>
> it seems that the parameter ${project.parent.basedir} is not resolved to
> my hive home directory /data/base/3rd/apache-hive-2.1.1-src,instead it is
> resolved to /data/base/3rd/apache-hive-2.1.1-src/packaging/${project.parent.basedir},very
> strange.
>
> Actually , the file /data/base/3rd/apache-hive-2.1.1-src/common/src/main/
> resources/hive-log4j2.properties exits. Anyone could give me some
> suggestions?
>
> Is ${project.parent.basedir} a maven built-in variable?
>

No.

The project.parent. fields are basically groupId, artifactId, version and
if you are lucky relativePath. See
https://maven.apache.org/ref/3.5.0/maven-model/maven.html#class_parent

>
> My maven version is 3.3.9.Does it have anything to do with maven assembly?
>
> The directory structure is :
>
> hive-2.1.1/
>     orc/
>     ql/
>     other modules/
>     packaging/
>        src/
>           main/
>               assembly/
>                    bin.xml/ #the pom which throws the error.
>                    src.xml/
>     pom.xml
> you can also check the hive source code  from github :
> https://github.com/apache/hive/tree/master/packaging/src/main/assembly <
> https://github.com/apache/hive/tree/master/packaging/src/main/assembly>
Loading...