如果文件不存在,则跳过Maven插件的执行

编程入门 行业动态 更新时间:2024-10-06 19:17:53
本文介绍了如果文件不存在,则跳过Maven插件的执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想将hibernate3-maven-plugin放在我的父pom中,如果给定文件不存在于子模块中,则跳过执行.

I want to put the hibernate3-maven-plugin in my parent pom and have execution skipped in child modules if a given file does not exist in that module.

有什么办法吗?

到目前为止,我必须这样做:

Up to now, I have had to do this:

<plugin> ... <configuration> <skip>true</skip> <propertyfile>target/test-classes/jdbc.properties</propertyfile> </configuration> </plugin>

在父POM中,并且:

<plugin> ... <configuration> <skip>${maven.test.skip}</skip> </configuration> </plugin>

在我要执行的所有子POM中.即那些实际上拥有jdbc.properties文件的人.

In all child POMs where I want it to execute. I.E Those actually having a jdbc.properties file.

推荐答案

您可以使用配置文件执行此操作,但是我想您可能不想在父项目中运行它,这可能会出现问题. br> 以下是个人资料上的一些链接:

You may be able to do this with profiles, but I suppose you'd probably not want to run it in the parent project, which may be problematic. Here are some links on profiles:

  • maven.apache/guides/introduction /introduction-to-profiles.html
  • www.sonatype/books/mvnref -book/reference/profiles.html
  • >: //mindthegab/2008/12/02/howto-give-your-multimodule-maven-build-subprojectenvironment-specific-behavior/
  • maven.apache/guides/introduction/introduction-to-profiles.html
  • www.sonatype/books/mvnref-book/reference/profiles.html
  • mindthegab/2008/12/02/howto-give-your-multimodule-maven-build-subprojectenvironment-specific-behavior/

这个问题,存在类似的问题,无法通过配置文件解决: activate-different-maven-profiles-depending-on-current-module

This question, had a similar issue and was not able to solve it with profiles: activate-different-maven-profiles-depending-on-current-module

更多推荐

如果文件不存在,则跳过Maven插件的执行

本文发布于:2023-11-02 06:58:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551681.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不存在   跳过   插件   文件   Maven

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!