mvn pom.xml中的占位符的错误使用方式导致的eclipse stackoverflow

1,异常信息堆栈 :

org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 

    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:192)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:116)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolveParentProject(MavenImpl.java:683)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolveParentProject(MavenImpl.java:670)
    at org.eclipse.m2e.wtp.internal.filtering.ResourceFilteringBuildParticipant.loadParentHierarchy(ResourceFilteringBuildParticipant.java:438)
    at org.eclipse.m2e.wtp.internal.filtering.ResourceFilteringBuildParticipant.executeCopyResources(ResourceFilteringBuildParticipant.java:249)
    at org.eclipse.m2e.wtp.internal.filtering.ResourceFilteringBuildParticipant.build(ResourceFilteringBuildParticipant.java:97)
    at org.eclipse.m2e.wtp.internal.build.WarProjectBuildParticipant.build(WarProjectBuildParticipant.java:50)
    at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:795)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:216)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:259)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:312)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:315)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:367)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:388)
    at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:501)
    at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:401)
    at org.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:177)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
Caused by: org.apache.maven.model.building.ModelBuildingException: 11 problems were encountered while building the effective model for com.cssn,search.coding:address-build:${address.version}
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 

    at org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException(DefaultModelProblemCollector.java:197)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:482)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:424)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:414)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:158)
    ... 32 more

!ENTRY org.eclipse.m2e.logback.appender 4 0 2019-01-26 14:44:08.197
!MESSAGE Could not read parent project
!STACK 0
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 

    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:192)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:116)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolveParentProject(MavenImpl.java:683)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolveParentProject(MavenImpl.java:670)
    at org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.loadParentHierarchy(AbstractMavenArchiverConfigurator.java:537)
    at org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.generateManifest(AbstractMavenArchiverConfigurator.java:372)
    at org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.mavenProjectChanged(AbstractMavenArchiverConfigurator.java:210)
    at org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator$1.build(AbstractMavenArchiverConfigurator.java:145)
    at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:795)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:216)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:259)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:312)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:315)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:367)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:388)
    at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:501)
    at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:401)
    at org.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:177)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
Caused by: org.apache.maven.model.building.ModelBuildingException: 11 problems were encountered while building the effective model for com.cssn,search.coding:address-build:${address.version}
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 
[ERROR] Resolving expression: '${address.version}': Detected the following recursive expression cycle in 'address.version': [address.version] @ 

    at org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException(DefaultModelProblemCollector.java:197)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:482)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:424)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:414)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:158)
    ... 32 more

!ENTRY org.eclipse.core.jobs 4 2 2019-01-26 14:44:08.204
!MESSAGE An internal error occurred during: "Building Workspace".
!STACK 0
java.lang.StackOverflowError
    at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:158)
    at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:143)
    at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:430)
    at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:143)
    at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:430)
    at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:143)
    at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:430)

2,项目主要有四个模块,一个父类模块build  和三个子模块csdn-db,csdn-pipeline,csdn-service

build 模块中的pom.xml 中为了使用脚本参数,将所有的版本信息都同意使用了占位符,占位符的格式就是异常栈信息中的格式${address-version}.

但是这样定义占位符信息是有要求的,首先根据https://maven.apache.org/pom.html#Properties官网中的 标签的使用介绍,可以以知道,占位符中定义的变量名称不可以和使用占位符处的标签名字相同,不然会出现相互引用,循环解析,进入死循环的节奏里。

https://stackoverflow.com/questions/42468041/what-is-wrong-with-my-pom-resolving-expression-detected-recursive-expression这篇文章中的错误异常信息就是因为占位符中的变量名字和标签名字相同造成死循环解析。

co.uk.multicom.test.project
fab-handler-automation
1.0-SNAPSHOT


    1.7.7
    ${suiteFile}
    ${environment}
    ${port}



    
        
            org.apache.maven.plugins
            maven-compiler-plugin
            3.5.1
            
                1.8
                1.8
            
        
        
            org.apache.maven.plugins
            maven-surefire-plugin
            2.19.1
            
                
                    
                        javax.xml.parsers.SAXParserFactory
                        org.apache.xerces.jaxp.SAXParserFactoryImpl
                    
                    
                        user.language
 en
                    
                
                
                
                    ${suiteFile}
                
                
                    ${environment}
                    ${port}
                
                
                    
                        parallel
                        methods
                    
                    
                        threadCount
                        1
                    
                    
                        dataproviderthreadcount
                        1
                    
                
            
        
    

 

错误的原因出在


    1.7.7
    ${suiteFile}
    ${environment}
    ${port}

原因是:When you use ${port} Maven looks for the value in X which here X=${port} and so on... So that's why you get a recursive issue here 。

也就是占位符的变量的名字port 和使用该占位符的标签的名字相同,造成的解析占位符的时候就去找标签名字,而标签中定义的值X(此处就是 ${port})又会去找标签中的值X(${port})又要去找port标签中的值。死循环就此产生。

3,may be you can read the maven documentation , it will tell us not support format which you writed.https://maven.apache.org/pom.html#Properties

 

你可能感兴趣的:(maven)