Maven2 cannot find parent from relative path

前端 未结 6 2330
心在旅途
心在旅途 2020-12-18 22:01

I\'m trying to use Maven2 but my child projects cannot find the parent project.

Directory structure is as follows:

--parent
  --pom.xml
--child
  --p         


        
6条回答
  •  悲&欢浪女
    2020-12-18 22:53

    You may have the packaging type and/or version id not matching. I got the same error as you but played around with the packaging type and got it to work. Try the following.

    The following is fragment of the parent pom.xml. The packaging type is "pom". I don't have any code for the parent app, only a common pom.xml for sharing:

       ... 
        com.mycompany.app
        parent
        ${app.version}
        pom
    

    Child's pom.xml. It is a webapp so packaging type is "war":

    
      com.mycompany.app
      parent
      ${app.version}
      ../parent/pom.xml
      war
    
    

提交回复
热议问题