简体   繁体   English

Jenkins使用参数和SVN构建作业

[英]Jenkins job build with parameters and SVN

I have a job in jenkins build with parameters. 我在詹金斯建立工作与参数。 A simple batch script which compiles one java file and runs it by passing those parameters as arguments. 一个简单的批处理脚本,它编译一个Java文件并通过将这些参数作为参数传递来运行它。

javac TestService.java
java TestService %environment% %service%

Now I need to search for a file in SVN Repo with file extension of %environment% and pass the location as an argument. 现在,我需要在SVN Repo中搜索文件扩展名为%environment%文件,并将位置作为参数传递。 Any solution? 有什么办法吗?

I think your best bet is to checkout the remote repo locally. 我认为您最好的选择是在本地签出远程仓库。 Try to run svn checkout ... before you run the java command. 在运行java命令之前,请尝试运行svn checkout ... To find the file name, either let the Java code search it or use the find command of your batch interpreter. 要查找文件名,请让Java代码对其进行搜索,或者使用批处理解释器的find命令。

Other options: Make sure you can access the remote SVN server via HTTP. 其他选项:确保可以通过HTTP访问远程SVN服务器。 Then write code to scrape the HTML pages recursively to find the file names. 然后编写代码以递归方式刮擦HTML页面以找到文件名。 You can do that in Java using HttpClient , for example. 例如,您可以使用HttpClient在Java中执行此操作。 You will want to switch your build process from javac to Maven or Gradle for this, though. 但是,您将为此需要将构建过程从javac切换到Maven或Gradle。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM