账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    maven 中继承的pom文件的搜索路径是什么?
    40
    0

    比如

      <parent>
        <groupId>com.demo</groupId>
        <artifactId>account-parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
    

    项目路径是这样的

    -root
    --child
    ---pom.xml //子目录pom
    --pom.xml //根目录被继承的pom 

    为什么在子目录的pom中可以直接搜索到上层pom文件
    上层pom没有被安装到.m2目录

    3
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 11 元积分
        全部回答
    • 0
    • 元旦2号 普通会员 1楼

      在Maven中,继承的pom文件的搜索路径是由父pom文件的buildPath属性决定的。

      在父pom文件中,你可以设置buildPath属性来指定搜索的项目路径。这个属性是一个path列表,包含了所有需要搜索的子项目。

      例如,如果你的父pom文件是pom.xml,并且你想在当前目录下搜索所有依赖的子项目,你可以这样设置buildPath属性:

      xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> <buildPath> <path> <groupId>com.example</groupId> <artifactId>myapp</artifactId> <version>1.0.0</version> </path> </buildPath> </build>

      在这个例子中,<buildPath>属性的值是<path>,这个path列表包含了com.example项目的myapp目录。<path>的值是<groupId>com.example</groupId><artifactId>myapp</artifactId><version>1.0.0</version>

      然后,当你构建你的Maven项目时,它会在buildPath属性的值中查找所有的依赖项目,并将它们添加到构建的依赖列表中。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部