How to configure maven hbm2hbmxml and hbm2java to run one after the other in mvn clean install

前端 未结 6 1397
一向
一向 2020-12-05 12:37

I need to be able to call mvn clean install and have maven call hibernate3:hbm2hbmxml to generate the mapping files from a database and after than call hbm2java to get the J

6条回答
  •  半阙折子戏
    2020-12-05 13:19

    Maven lifecycle

    mvn clean dependency:copy-dependencies package
    

    If this were to be executed, the clean phase will be executed first (meaning it will run all preceeding phases of the clean lifecycle, plus the clean phase itself), and then the dependency:copy-dependencies goal, before finally executing the package phase (and all its preceeding build phases of the default lifecycle).

    So, perhaps:

    mvn clean hibernate3:hbm2hbmxml hibernate3:hbm2java package
    

    That said, I'd recommend against perpetually generating classes. This makes you very inflexible.

    After your comment, it seems like an "unwise" behaviour from the hibernate plugin. You can bypass that by "manually" copying the required files to the desired directory, using the Maven antrun plugin.

提交回复
热议问题