1

私は、既存のプロジェクトをMavenに変換し、そのビルドとリリースのプロセスを進めています。私の構造はこのようなものです ParentProj -Child1 -Child2 -ChildWeb3 -ChildWeb4

Mavenのベストプラクティスが何を言っているのかわかりませんが、必要です1.すべての子プロジェクトに個別にタグを付けるには2.展開サーバー(mvn release:prepare release:perform -B)で転送すると、一種のリポジトリが作成されますIリモートサーバーにフォルダーを作成し、すべての jar と wars をその中にのみ入れ、他のファイルは入れないようにしたい 3. また、リモートサーバーでシェルスクリプトを実行する方法はありますか

ご指導お待ちしております

4

1 に答える 1

1

あなたがしなければならないことは、Maven の規則と推奨されるベスト プラクティスに反します。覚えておかなければならないのは、Maven はデプロイではなく、ビルドとリリースを行うということです。はい、デプロイの目標がありますが、その目標はビルドまたはリリースから生成されたアーティファクトを取得し、アーティファクトのすべてのバージョンを格納しているリモートの Maven リポジトリにプッシュします。このリポジトリ構造により、mvn release:perform を実行すると、JAR ファイルと WAR ファイルが異なるフォルダーに配置されます。これは、maven に mvn deploy を実行するように要求する別の方法です。

Now if you want to keep with the Maven way of doing things, you should write another script (shell, Ant, your choice) for deployment that would get those JAR and WAR files from the remote Maven artifact repository and bundle them up the way you want and deploy it to the server(s) you want them installed on.

Now, you can change maven to sort of do what you want your are asking, but you'll have to create another project/module that only does bundling of the JAR and WAR files in the way you want as an archive file (tar, gzip, zip). The Maven assembly plugin is the tool to do this job. You can find out more about the assembly plugin here. Now, keep in mind, mvn release:perform will still push the archive to the Maven repository. You'll still need to have a deployment script to get the archive file from the remote Maven repository and extract it to the server you want to deploy it to.

于 2010-11-29T18:28:24.903 に答える