小编mat*_*lli的帖子

无法在gradle maven-publish插件中传输工件pom

我使用gradle(2.9)maven-publish插件将文件发布到私有nexus maven repo.build.gradle文件是

apply plugin: 'maven-publish'

publishing {
    repositories {
        maven {
            name "example-maven"
            url "https://..."
            credentials {
                username mavenUser
                password mavenPassword
            }
        }
    }
    publications {
        maven(MavenPublication) {

            groupId 'com.example.karaf-utils'
            artifactId 'esa-bootstrapper'
            version '1.0.0'

            artifact source: "${projectDir}/kar/example.esa.bootstrapper.kar", extension: 'kar'

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

kar文件已正确上传,在nexus中我可以看到预期的xml描述符:

<dependency>
  <groupId>com.example.karaf-utils</groupId>
  <artifactId>esa-bootstrapper</artifactId>
  <version>1.0.0</version>
  <type>kar</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)

但不幸的是,在执行publish任务期间,我收到以下错误:

gradle :com.example.karaf.subsys.bootstrap:publish
:com.example.karaf.subsys.bootstrap:generatePomFileForMavenPublication
:com.example.karaf.subsys.bootstrap:publishMavenPublicationToexample-mavenRepository
Upload https://nexus.dev.example.io/nexus/content/repositories/example-maven/com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.kar
Upload https://nexus.dev.example.io/nexus/content/repositories/example-maven/com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.kar.sha1
Upload https://nexus.dev.example.io/nexus/content/repositories/example-maven/com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.kar.md5
Upload https://nexus.dev.example.io/nexus/content/repositories/example-maven/com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.pom
Could not transfer artifact com.example.karaf-utils:esa-bootstrapper:pom:1.0.0 from/to remote (https://nexus.dev.example.io/nexus/content/repositories/example-maven): Could not write to resource …
Run Code Online (Sandbox Code Playgroud)

gradle maven-publish

8
推荐指数
1
解决办法
6295
查看次数

Gradle 自定义插件的构建抛出“无法解析类”

我正在尝试构建一个 gradle 自定义插件,该插件又依赖于其他插件。特别是,该插件依赖于com.bmuschko.docker-remote-api插件(同样依赖于 java 库com.github.docker-java:docker-java:2.1.1)。

所以我尝试使用以下gradle.build文件

apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'com.bmuschko.docker-remote-api'

buildscript {
  repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.bmuschko:gradle-docker-plugin:2.6.1'
    }
}

group = 'com.example'
version = '1.0'

dependencies {
    compile gradleApi()
    compile localGroovy()
    compile group: 'com.github.docker-java', name: 'docker-java', version: '2.1.1'
}
Run Code Online (Sandbox Code Playgroud)

以及以下插件文件:

package com.example.build

import org.gradle.api.Project
import org.gradle.api.Plugin

import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
class BndPlugin implements Plugin<Project> {

    @Override
    void apply(Project project) {
        task buildDockerImage(type: DockerBuildImage) {
            println file("${projectDir}/docker/")
        }
    } …
Run Code Online (Sandbox Code Playgroud)

plugins gradle

7
推荐指数
1
解决办法
7294
查看次数

在java中生成证书链

问题是如何在Java中以编程方式生成证书链.换句话说,我想在java中执行这里详述的操作:http://fusesource.com/docs/broker/5.3/security/i382664.html

通常,我可以为新客户创建RSA密钥:

private KeyPair genRSAKeyPair(){
    // Get RSA key factory:
    KeyPairGenerator kpg = null;
    try {
        kpg = KeyPairGenerator.getInstance("RSA");
    } catch (NoSuchAlgorithmException e) {
        log.error(e.getMessage());
        e.printStackTrace();
        return null;
    }
    // Generate RSA public/private key pair:
    kpg.initialize(RSA_KEY_LEN);
    KeyPair kp = kpg.genKeyPair();
    return kp;
Run Code Online (Sandbox Code Playgroud)

}

我生成相​​应的证书:

private X509Certificate generateCertificate(String dn, KeyPair pair, int days, String algorithm)
  throws GeneralSecurityException, IOException  {
    PrivateKey privkey = pair.getPrivate();
    X509CertInfo info = new X509CertInfo();
    Date from = new Date();
    Date to = new Date(from.getTime() …
Run Code Online (Sandbox Code Playgroud)

java security rsa jce x509certificate

6
推荐指数
2
解决办法
2万
查看次数

断言失败:运行时反射Universe中的不安全符号DeveloperApi

我在Java 8程序中运行以下行

SparkConf sparkConf = new SparkConf();
sparkConf.setAppName("testJob");
sparkConf.setMaster("spark://blahblah:7077");
SparkSession sparkSession = SparkSession.builder().config(sparkConf).getOrCreate();
SQLContext sqlContext = new SQLContext(sparkSession);
Dataset<Row> ds = sqlContext.sql("SHOW TABLES");
Run Code Online (Sandbox Code Playgroud)

我得到了一个非常神秘的例外(运行sqlContext.sql("SHOW TABLES")线)

java.lang.RuntimeException: error reading Scala signature of
    org.apache.spark.sql.package: assertion failed: unsafe symbol 
    DeveloperApi (child of package annotation) in runtime reflection universe
Run Code Online (Sandbox Code Playgroud)

(在这个问题的最后报告了完整的堆栈跟踪).

任何人都可以给我一个如何解决这个问题的提示吗?这是什么意思?


[Gogo shell] INFO org.apache.spark.util.Utils - Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 51077.
[Gogo shell] INFO org.apache.spark.network.netty.NettyBlockTransferService - Server created on 172.29.30.215:51077
[Gogo shell] INFO org.apache.spark.storage.BlockManagerMaster - Registering BlockManager BlockManagerId(driver, 172.29.30.215, 51077) …
Run Code Online (Sandbox Code Playgroud)

java scala apache-spark

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

SAXSource 和 org.w3c.dom.Document

我有一个javax.xml.transform.sax.SAXSource,我想得到一个org.w3c.dom.Document对象。我已经在谷歌上搜索了几个小时,但我很沮丧。

此外,InputSource返回的SAXSource#getInputSource()为空,因此我不能使用它来构建org.w3c.dom.Document.

顺便说一下,我想要实现的是从 SAXSource 中包含的 xml 中删除一些 xml 元素。

感谢您的帮助!

只是关于我的环境的一些信息:SAXSource 通过invoke以下 javax.xml.ws 调度程序的方法返回给我:

Service service = Service.create(serviceName);         
//...
javax.xml.ws.Dispatch<Source> dispatcher = 
        service.createDispatch(portName, Source.class, Service.Mode.MESSAGE);
Run Code Online (Sandbox Code Playgroud)

java xml dom sax

3
推荐指数
1
解决办法
1916
查看次数

制作在给定间隔内自动运行的代码

关于让代码在给定的时间间隔内自动运行,我有几个问题.我正在编程一种游戏模式,它检查玩家是否杀死了地图中的所有怪物(我有这些方法).我想知道编程这个检查的最佳方法是什么?我已经查找了一个人在类构造函数中创建ScheduledExecutorService的方法....

private ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
Run Code Online (Sandbox Code Playgroud)

但我在网上看到人们使用的地方

static void main(String[] args) {
Run Code Online (Sandbox Code Playgroud)

并且运行方法来进行检查.哪个更好?我只是希望每隔几秒左右运行一次检查,看看玩家是否已清除地图,如果他或她有,则进入下一阶段.

java schedule task

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

标签 统计

java ×4

gradle ×2

apache-spark ×1

dom ×1

jce ×1

maven-publish ×1

plugins ×1

rsa ×1

sax ×1

scala ×1

schedule ×1

security ×1

task ×1

x509certificate ×1

xml ×1