use*_*026 5 svn compilation maven
我正在将 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>
Run Code Online (Sandbox Code Playgroud)
是的,与 Ant 中的方式类似。在预编译阶段之一(可能是在generate-sources中)执行该svn命令。我会尝试这样的事情(这是一个大脑转储,可能包含小错误):exec-maven-plugin
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>...</version>
<executions>
<execution>
<id>svn</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<configuration>
<executable>svn</executable>
<arguments>
<argument>co</argument>
<argument>${svn.projecturl}</argument>
<argument>${project.build.root}</argument>
...
</arguments>
<configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
编辑
普朗格的回答让我思考——你真正想要实现什么?如果项目始终是构建的一部分,那么更好的方法是“mavenize”它(为其编写 POM)并将其包含为模块/依赖项。
如果 SVN 签出是一次性操作,也许最好保持原样,将 jar 添加到存储库mvn install:install-file(分配组 id 和工件 id),并将其用作依赖项?
| 归档时间: |
|
| 查看次数: |
4421 次 |
| 最近记录: |