Maven - 从 SVN 提取代码
我正在将 J2ee 项目从 Ant 迁移到 Maven,
ant 任务之一是从 SVN 存储库中提取现有源
编译它,并将其 jar 添加到我当前的构建中作为 Jar
是否可以获取源代码并在 Maven 中编译它?
谢谢你!
<target name="checkoutBuild" description="Pulls code from SVN into the build directory">
<exec executable="svn">
<arg line="co ${svn.projecturl} ${project.build.root} -r ${svn.revision} --username ${svn.username} --password ${svn.password}"/>
</exec>
</target>
I am migrating J2ee Project from Ant to Maven,
One of The ant tasks is to pull existing source from SVN Repository
Compile it, and add its jar to my current build as Jar
Is it possible to do the get the source and compile it in Maven?
Thank you!
<target name="checkoutBuild" description="Pulls code from SVN into the build directory">
<exec executable="svn">
<arg line="co ${svn.projecturl} ${project.build.root} -r ${svn.revision} --username ${svn.username} --password ${svn.password}"/>
</exec>
</target>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,与 Ant 中的方式类似。在预编译阶段之一(可能是在生成源中)执行 exec-maven-plugin 中的 svn 命令。我会尝试这样的事情(这是一个大脑转储,可能包含小错误):
编辑
普朗格的回答让我思考 - 你真正想要实现什么?如果项目始终是构建的一部分,那么更好的方法是“mavenize”它(为其编写 POM)并将其包含为模块/依赖项。
如果 SVN 签出是一次性操作,也许最好保持原样,使用
mvn install:install-file
将 jar 添加到存储库(分配组 ID 和工件) id),并将其用作依赖项?Yes, in a similar way as in Ant. Execute the
svn
command inexec-maven-plugin
in one of pre-compile phases, perhaps in generate-sources. I'd try something like this (it's a brain-dump, may contain minor mistakes):EDIT
Prunge's answer made me think — what do you want to really achieve? If the project is always to be the part of the build, a far better way would be to "mavenize" it (write a POM for it) and include it as a module/dependency.
If the SVN checkout is to be a one-time action, maybe it's better to leave it as it is, add the jar to the repository with
mvn install:install-file
(assigning a group id and artifact id), and use it as a dependency?你也许可以,但这不是做事的“Maven 方式”。
查看 Maven 发布插件 文档。
您通常要做的是:
You probably can, but it is not the 'Maven Way' of doing things.
Take a look at the Maven Release Plugin documentation.
What you'd typically do is: