小编Sag*_*gar的帖子

Jenkins从gitHub克隆时出错

我是新手Jenkins,我从克隆存储库时遇到以下错误GitHub.

我试图在这里搜索所有相关问题,但可以找到确切的stacktstrace与答案.

我正在尝试克隆需要用户名和密码的SSH://存储库,我正在为我的工作提供作业配置设置中的存储库路径.我还没有做任何相关的设置,因为这似乎与GIT存储库的安全问题不同.

我无法弄清楚Jenkins试图执行什么评论,哪个文件/目录没有发现无能为力.

这是Jenkins工作的确切堆栈跟踪:

引起:java.io.IOException:无法运行程序:尝试确定git版本时出错:执行命令时出错: - version假设1.6错误:错误克隆远程repo'myRE':无法克隆git@github.com:myORG /RVL.myProj.git hudson.plugins.git.GitException:无法在hudson的hudson.plugins.git.GitAPI.clone(GitAPI.java:268)克隆git@github.com:myORG/RVL.myProj.git. plugins.git.GitSCM $ 2.invoke(GitSCM.java:1122)位于hudson.FilePath的Hudson.File上,hudson.FilePath.act(FilePath.java:842)的hudson.plugins.git.GitSCM $ 2.invoke(GitSCM.java:1064)位于hudson.model.AbstractProject.checkout(AbstractProject.java:1256)的hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064)的.act(FilePath.java:824)位于hudson.model.AbstractBuild $ AbstractBuildExecution. defaultCheckout(AbstractBuild.java:589)jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)at hudson.model.AbstractBuild $ AbstractBuildExecution.run(AbstractBuild.java:494)at hudson.model.Run.execute(Run .java:1502)在hudson.maven .mavenModuleSetBuild.run(MavenModuleSetBuild.java:477)位于hudson.model.ResourceController.exe(ResourceController.java:88)的hudson.model.Executor.run(Executor.java:236)引起:hudson.plugins.git. GitException:执行命令时出错:clone -o RVL.myProj git@github.com:myORG/RVL.myProj.git/var/lib/jenkins/jobs/myProj/workspace at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI. java:862)at hudson.plugins.git.GitAPI.access $ 000(GitAPI.java:40)at hudson.plugins.git.GitAPI $ 1.invoke(GitAPI.java:264)at hudson.plugins.git.GitAPI $ 1.在hudson.filePath.act(FilePath.java:824)的hudson.FilePath.act(FilePath.java:824)上的hudson.plugins.git.GitAPI.clone(GitAPI.java:244)调用(GitAPI.java:244) )... 13更多 引起:java.io.IOException:无法运行程序"":error = 2,在hudson.Proc $ LocalProc的java.lang.ProcessBuilder.start(未知来源)中没有这样的文件或目录.( Proc.java:244)at hudson.Proc $ LocalProc.(Proc.java:216)at hudson.Launcher $ LocalLauncher.launch(Launcher.java:709)at at hudson.Launcher $ ProcStarter.start(Launcher.java:338)at hudson.Launcher $ ProcStarter.join(Launcher.java:345)at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:843)... 19更多引起:java.io.IOException:error = 2,java.lang.Pro中的java.lang.UNIXProcess.(未知源)java.lang.UNIXProcess.forkAndExec(本机方法)中没有此类文件或目录

git github jenkins

27
推荐指数
1
解决办法
5万
查看次数

Elasticsearch Java API中的过滤查询

在Elasticsearch Java API中创建Filtered查询时我有点困惑.SearchRequestBuilder类有setPostFilter方法,这个方法的javadoc清楚地表明在执行Query之后将应用过滤器.

但是,没有setFilter方法或其他一些允许在
执行查询之前应用过滤器的方法.如何创建过滤查询(在执行查询之前基本上应用过滤器)?我错过了什么吗?

elasticsearch

24
推荐指数
3
解决办法
3万
查看次数

Java通用代码

我是仿制药的新手.你可以看到,我知道的确切类型后重复一些代码val,filterSmall,filterGreat.我想编写用于val与过滤器值进行比较的通用代码.我可以写这样的东西

  private  <T> boolean  compareAgainstFilters(T val, T filterSmall, T filterGreat) {
    if (!(filterSmall != null && filterSmall <= val)) {
        return true;
    } 

    if (!(filterGreat != null && val <= filterGreat)) {
        return true;
    }
    return true;
}
Run Code Online (Sandbox Code Playgroud)

但是在编译时,java不知道<=运算符是否对类型有效T.

我不想重复代码,那么我怎么能实现呢?

if (value != null) {
        switch (value.getClass().getName()) {
        case "java.lang.Long":
            Long filterSmall = (Long) filterSmaller;
            Long filterGreat = (Long) filterGreater;
            Long val = (Long) value;

            if (!(filterSmall != …
Run Code Online (Sandbox Code Playgroud)

java generics java-8

17
推荐指数
1
解决办法
672
查看次数

Elasticsearch中的null_value映射

我已经为索引中的tweetb类型创建了一个映射twitter:

curl -XPUT http://www.mydomain:9200/twitter/tweetb/_mapping -d '{
  "twitter": {
    "mappings": {
      "tweetb": {
        "properties": {
          "message": {
            "type": "string",
            "null_value": "NA"
          }
        }
      }
    }
  }
}'
Run Code Online (Sandbox Code Playgroud)

然后,我把一个文件:

curl -XPUT http://www.mydomain.com:9200/twitter/tweetb/1 -d '{"message": null}'
Run Code Online (Sandbox Code Playgroud)

然后,我试图让插入的doc回来:

curl -XGET http://www.mydomain:9200/twitter/tweetb/1
Run Code Online (Sandbox Code Playgroud)

那回来了:

{
  "_index": "twitter",
  "_type": "tweetb",
  "_id": "1",
  "_version": 2,
  "found" : true,
  "_source" : { "message": null }
}
Run Code Online (Sandbox Code Playgroud)

"message" : "NA"_source田野里期待着.但是,它似乎"null_value"不起作用.我错过了什么吗?

elasticsearch

16
推荐指数
1
解决办法
6670
查看次数

Stream上的收集操作是否会关闭流和底层资源?

以下代码是否需要包含在try-with-resources中以确保底层文件已关闭?

List<String> rows = Files.lines(inputFilePath).collect(Collectors.toList());
Run Code Online (Sandbox Code Playgroud)

java file-io java-8 try-with-resources java-stream

16
推荐指数
2
解决办法
2741
查看次数

线程与CompletableFuture

将代码直接传递给线程vs使用CompletableFuture的优势是什么?

Thread thread = new Thread(() -> {do something});
thread.start();
Run Code Online (Sandbox Code Playgroud)

VS

CompletableFuture<Void> cf1 =  
     CompletableFuture.runAsync(() -> {do something}); 
Run Code Online (Sandbox Code Playgroud)

java multithreading java-8 completable-future

13
推荐指数
2
解决办法
2433
查看次数

使用带有并行流的forEachOrdered的好处

Oracle官方文档说:

请注意,如果对并行流使用forEachOrdered等操作,则可能会失去并行性的好处. Oracle - 并行性

forEachOrdered如果我们失去并行性,为什么有人会使用并行流呢?

java java-8

9
推荐指数
1
解决办法
1129
查看次数

在JPA中使多对多关系可缓存

User和之间有多对多的关系Role.第三个表称为UserRole映射为连接表.

在JPA中,我可以缓存UserRole使用@Cachable; 但是当我尝试获取与定义Role的关联的s时,将执行数据库查询以从连接表中获取值.UserEAGER

如何在User和之间缓存连接表Role

hibernate jpa

6
推荐指数
1
解决办法
741
查看次数

Collectors.joining与StringBuilder.append

在性能方面哪个更好?

finalWords.stream().forEach(word -> stringBuilder.append(word).append(”,“)); 
String finalResult = stringBuilder.toString();
Run Code Online (Sandbox Code Playgroud)

VS

String finalResult = finalWords.stream().collect(Collectors.joining(","));
Run Code Online (Sandbox Code Playgroud)

java java-8 java-stream

5
推荐指数
1
解决办法
875
查看次数

JsonIgnore on Field vs JsonIgnore on getter in Jackson

是什么区别JsonIgnore在现场VSJsonIgnore在现场的杰克逊的吸?

java jackson java-8 jackson2

5
推荐指数
1
解决办法
9601
查看次数