我正在使用 Jenkins 在 Tomcat7 上部署 Web 应用程序。
Tomcat 安装为 windows 服务,它有 SWebServer 名称(安装路径:C:\Program Files (x86)\SWebServer)。Jenkins 也安装为 Windows 服务。应用程序war文件位置是:C:\Program Files (x86)\Jenkins\jobs\test4\workspace\target\prj.war
这是我的配置:
但我收到以下异常
Deploying C:\Program Files (x86)\Jenkins\jobs\test4\workspace\target\prj.war to container Tomcat 7.x Remote
ERROR: Build step failed with exception
org.codehaus.cargo.container.ContainerException: Failed to redeploy [C:\Program Files (x86)\Jenkins\jobs\test4\workspace\target\prj.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:193)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
at hudson.FilePath.act(FilePath.java:989)
at hudson.FilePath.act(FilePath.java:967)
at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
at hudson.model.Run.execute(Run.java:1743)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: …
Run Code Online (Sandbox Code Playgroud) 我写了一个正则表达式,应该检查字符串是否包含单词'Page',然后是任何数字这是代码:
public static void main(String[] args) {
String str1 = "12/15/14 7:01:44 Page 10 ";
String str2 = "12/15/14 7:01:44 Page 9 ";
System.out.println(containsPage(str2));
}
private static boolean containsPage(String str) {
String regExp = "^.*Page[ ]{1,}[0-9].$";
return Pattern.matches(regExp, str);
}
Run Code Online (Sandbox Code Playgroud)
结果:str1:false,str2:true
你能帮我解决什么问题吗?
我有 3 个 xml 文件build.xml, build_1.xml, build_2.xml
。这些build_1.xml, build_2.xml
文件的目标名称为 'compress
”。
如何配置build.xml
文件,当我调用“ ant compress 1
”时,它会从文件运行压缩目标,并相应地在“ ”的情况下build_1.xml
运行压缩目标?build_2.xml
ant compress 2
如何在 build.gradle 中配置 Flyway 以从其他属性文件获取 url、用户名、密码?
而不是这个:
flyway {
url = 'jdbc:postgresql://localhost:5432/db'
user = 'a'
password = 'a'
locations = ['filesystem:db/migration']
}
Run Code Online (Sandbox Code Playgroud)
像这样的东西:
flyway {
path = ['filesystem:src/main/resources/data-access.properties']
locations = ['filesystem:db/migration']
}
Run Code Online (Sandbox Code Playgroud) 如何在没有迭代给出5的情况下以简短的方式做到这一点?
List<Integer> l = new ArrayList<Integer>();
for (int i = 1; i <= 5; i++) {
l.add(i);
}
Run Code Online (Sandbox Code Playgroud) 我想将日期(以毫秒为单位)转换为日期,但它无法正确转换.
public static void main(String[] args) {
LocalDate today = LocalDateTime.now().toLocalDate();
System.out.println("Today: ----------" + today);
long todayLong = today.atStartOfDay(ZoneId.systemDefault()).toEpochSecond();
System.out.println("todayLong: ---------- " + todayLong);
LocalDate todayBack = Instant.ofEpochMilli(todayLong).atZone(ZoneId.systemDefault()).toLocalDate();
System.out.println("todayBack: ---------- "+todayBack);
}
Run Code Online (Sandbox Code Playgroud)
这是输出:
今天:---------- 2017-06-27
今天龙:---------- 1498507200
今天回来:---------- 1970-01-18
我编写了应该创建 Excel 文件(xlsx 或 xls)并将自定义背景颜色设置为单元格的代码。创建 xls 文件时,背景颜色工作正常,但在 xlsx 的情况下,背景颜色未设置为正确的颜色。
我的代码有什么问题?
public class PoiWriteExcelFile {
static Workbook workbook;
static Sheet worksheet;
public static void main(String[] args) {
try {
String type = "xlsx"; //xls
FileOutputStream fileOut = new FileOutputStream("D:\\poi-test." + type);
switch (type) {
case "xls":
workbook = new HSSFWorkbook();
break;
case "xlsx":
workbook = new XSSFWorkbook();
break;
}
CellStyle cellStyle = workbook.createCellStyle();
switch (type) {
case "xls":
HSSFPalette palette = ((HSSFWorkbook) workbook).getCustomPalette();
palette.setColorAtIndex(HSSFColor.LAVENDER.index, (byte)128, (byte)0, (byte)128);
HSSFColor hssfcolor = palette.getColor(HSSFColor.LAVENDER.index); …
Run Code Online (Sandbox Code Playgroud)