maven scm插件在每次执行中删除输出文件夹
我需要从 2 个不同的 svn 位置下载到同一输出目录。所以我配置了两个不同的执行。但每次执行签出都会删除输出目录,因此它也会删除已下载的项目。
这是我的 pom.xml 的示例:
<profile>
<id>checkout</id>
<activation>
<property>
<name>checkout</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.3</version>
<configuration>
<username>${svn.username}</username>
<password>${svn.pass}</password>
<checkoutDirectory>${path}</checkoutDirectory>
<skipCheckoutIfExists/>
</configuration>
<executions>
<execution>
<id>checkout_a</id>
<configuration>
<connectionUrl>scm:svn:https://host_n/folder</connectionUrl>
<checkoutDirectory>${path}</checkoutDirectory>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>checkout</goal>
</goals>
</execution>
<execution>
<id>checkout_b</id>
<configuration>
<connectionUrl>scm:svn:https://host_l/anotherfolder</connectionUrl>
<checkoutDirectory>${path}</checkoutDirectory>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>checkout</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
有什么方法可以阻止执行删除文件夹 ${path} 吗?
我想出了一个解决方案,但我无法让它工作:
我在配置文件中添加了 maven-clean-plugin 的执行:
<profile>
<id>checkout</id>
...
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>not-clean</id>
<configuration>
<filesets>
<fileset>
<directory>${path}</directory>
<excludes>
<exclude>*/*</exclude>
</excludes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
<phase>initialize</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
但我无法意识到如何排除文件夹中的所有内容。
有什么想法吗?
I need to download from 2 different svn locations to the same output directory. So i configured 2 different executions. But every time it executes a checkout deletes the output directory so it also deletes the already downloaded projects.
Here is a sample of my pom.xml:
<profile>
<id>checkout</id>
<activation>
<property>
<name>checkout</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.3</version>
<configuration>
<username>${svn.username}</username>
<password>${svn.pass}</password>
<checkoutDirectory>${path}</checkoutDirectory>
<skipCheckoutIfExists/>
</configuration>
<executions>
<execution>
<id>checkout_a</id>
<configuration>
<connectionUrl>scm:svn:https://host_n/folder</connectionUrl>
<checkoutDirectory>${path}</checkoutDirectory>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>checkout</goal>
</goals>
</execution>
<execution>
<id>checkout_b</id>
<configuration>
<connectionUrl>scm:svn:https://host_l/anotherfolder</connectionUrl>
<checkoutDirectory>${path}</checkoutDirectory>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>checkout</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Is there any way to prevent the executions to delete the folder ${path} ?
I came up with a solution but I cant get it to work:
I added to the profile a execution of maven-clean-plugin:
<profile>
<id>checkout</id>
...
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>not-clean</id>
<configuration>
<filesets>
<fileset>
<directory>${path}</directory>
<excludes>
<exclude>*/*</exclude>
</excludes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
<phase>initialize</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
But I cant realize how to exclude everything in folder.
Any Idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是:将每个 SVN 位置放入 Maven 模块(子项目)中,然后创建第三个项目,其中包含连接两个项目的代码。
背景:使用 Maven,每个 POM.xml 始终拥有一个项目。如果您觉得需要连接多个位置的数据,请创建模块,然后使用父 POM 将它们连接到一个“反应堆项目”中。
要构建,请在父“反应堆项目”中调用 Maven。
Yes: Put each SVN location in a Maven module (a sub-project) and then create a third project which contains the code to join the two.
Background: With Maven, you always have one project per POM.xml. If you feel that you need to join data from several places, create modules and then use a parent POM to join them into one "reactor project".
To build, invoke Maven in the parent "reactor project".
我修改了maven-scm-plugin的源代码。添加了我需要的功能。
感谢您的时间和帮助!
I've modified the source of the maven-scm-plugin. Added functionality I needed.
Thanks for your time and help!