- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在将 JAVA maven 项目迁移到 gradle。我在 maven 中添加了一个 Shade 插件,但是当我试图在 gradle 中复制它时,它目前失败了。它在清理时失败,即当我发出以下命令时,
gradle clean
请在下面找到 pom.xml 文件和对应的 build.gradle 文件。
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproj.integration</groupId>
<artifactId>Generic-Integration</artifactId>
<name>Generic-Integration</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<finalName>myproj-integration-${project.version}</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<createDependencyReducedPom>true</createDependencyReducedPom>
<relocations>
<relocation>
<pattern>jersey.repackaged</pattern>
<shadedPattern>myproj.repackaged</shadedPattern>
</relocation>
<relocation>
<pattern>javassist</pattern>
<shadedPattern>myproj.repackaged.javassist</shadedPattern>
</relocation>
<relocation>
<pattern>org.aopalliance</pattern>
<shadedPattern>myproj.repackaged.org.aopalliance</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.logging</pattern>
<shadedPattern>myproj.repackaged.org.apache.logging</shadedPattern>
</relocation>
<relocation>
<pattern>org.codehaus.jackson</pattern>
<shadedPattern>myproj.repackaged.org.codehaus.jackson</shadedPattern>
</relocation>
<relocation>
<pattern>org.glassfish.hk2</pattern>
<shadedPattern>myproj.repackaged.org.glassfish.hk2</shadedPattern>
</relocation>
<relocation>
<pattern>org.glassfish.jersey</pattern>
<shadedPattern>myproj.repackaged.org.glassfish.jersey</shadedPattern>
</relocation>
<relocation>
<pattern>org.json</pattern>
<shadedPattern>myproj.repackaged.org.json</shadedPattern>
</relocation>
<relocation>
<pattern>org.jvnet</pattern>
<shadedPattern>myproj.repackaged.org.jvnet</shadedPattern>
</relocation>
<relocation>
<pattern>javax.annotation</pattern>
<shadedPattern>myproj.repackaged.javax.annotation</shadedPattern>
</relocation>
<relocation>
<pattern>javax.inject</pattern>
<shadedPattern>myproj.repackaged.javax.inject</shadedPattern>
</relocation>
<relocation>
<pattern>javax.ws</pattern>
<shadedPattern>myproj.repackaged.javax.ws</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.myproj.integration.ServiceExecuter</mainClass>
</transformer>
</transformers>
<artifactSet>
<includes>
<include>com.myproj:Util</include>
<include>org.glassfish.hk2:hk2-api</include>
<include>org.glassfish.hk2:hk2-utils</include>
<include>org.glassfish.hk2:hk2-locator</include>
<include>org.glassfish.hk2:osgi-resource-locator</include>
<include>org.glassfish.hk2.external:aopalliance-repackaged</include>
<include>org.codehaus.jackson:jackson-core-asl</include>
<include>org.codehaus.jackson:jackson-mapper-asl</include>
<include>org.codehaus.jackson:jackson-jaxrs</include>
<include>org.codehaus.jackson:jackson-xc</include>
<include>org.javassist:javassist</include>
<include>javax.annotation:javax.annotation-api</include>
<include>org.glassfish.hk2.external:javax.inject</include>
<include>javax.ws.rs:javax.ws.rs-api</include>
<include>org.glassfish.jersey.core:jersey-client</include>
<include>org.glassfish.jersey.core:jersey-common</include>
<include>org.glassfish.jersey.bundles.repackaged:jersey-guava</include>
<include>org.glassfish.jersey.media:jersey-media-json-jackson</include>
<include>org.json:json</include>
<include>com.myproj:JAXRS</include>
</includes>
</artifactSet>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.myproj</groupId>
<artifactId>JAXRS</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>8.1.16.v20140903</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.myproj</groupId>
<artifactId>Server</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
<scope>test</scope>
</dependency>
</dependencies>
build.gradle
plugins {
id 'com.github.johnrengelman.shadow' version '1.2.3'
}
shadowJar {
artifactSet {
include 'com.myproj:Util'
include 'org.glassfish.hk2:hk2-api'
include 'org.glassfish.hk2:hk2-utils'
include 'org.glassfish.hk2:hk2-locator'
include 'org.glassfish.hk2:osgi-resource-locator'
include 'org.glassfish.hk2.external:aopalliance-repackaged'
include 'org.codehaus.jackson:jackson-core-asl'
include 'org.codehaus.jackson:jackson-mapper-asl'
include 'org.codehaus.jackson:jackson-jaxrs'
include 'org.codehaus.jackson:jackson-xc'
include 'org.javassist:javassist'
include 'javax.annotation:javax.annotation-api'
include 'org.glassfish.hk2.external:javax.inject'
include 'javax.ws.rs:javax.ws.rs-api'
include 'org.glassfish.jersey.core:jersey-client'
include 'org.glassfish.jersey.core:jersey-common'
include 'org.glassfish.jersey.bundles.repackaged:jersey-guava'
include 'org.glassfish.jersey.media:jersey-media-json-jackson'
include 'org.json:json'
include 'com.myproj:JAXRS'
}
relocation {
pattern = 'jersey.repackaged'
shadedPattern = 'myproj.repackaged'
}
relocation {
pattern = 'javassist'
shadedPattern = 'myproj.repackaged.javassist'
}
relocation {
pattern = 'org.aopalliance'
shadedPattern = 'myproj.repackaged.org.aopalliance'
}
relocation {
pattern = 'org.apache.logging'
shadedPattern = 'myproj.repackaged.org.apache.logging'
}
relocation {
pattern = 'org.codehaus.jackson'
shadedPattern = 'myproj.repackaged.org.codehaus.jackson'
}
relocation {
pattern = 'org.glassfish.hk2'
shadedPattern = 'myproj.repackaged.org.glassfish.hk2'
}
relocation {
pattern = 'org.glassfish.jersey'
shadedPattern = 'myproj.repackaged.org.glassfish.jersey'
}
relocation {
pattern = 'org.json'
shadedPattern = 'myproj.repackaged.org.json'
}
relocation {
pattern = 'org.jvnet'
shadedPattern = 'myproj.repackaged.org.jvnet'
}
relocation {
pattern = 'javax.annotation'
shadedPattern = 'myproj.repackaged.javax.annotation'
}
relocation {
pattern = 'javax.inject'
shadedPattern = 'myproj.repackaged.javax.inject'
}
relocation {
pattern = 'javax.ws'
shadedPattern = 'myproj.repackaged.javax.ws'
}
}
dependencies {
compile project(':JAXRS')
compile project(':Server')
testCompile group: 'org.testng', name: 'testng', version:'6.8.8'
compile(group: 'org.eclipse.jetty', name: 'jetty-servlet', version:'8.1.16.v20140903') {
/* This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. */
}
}
task genericIntegrationJar(type: Jar) {
baseName = 'myproj-integration-1.2'
from { configurations.external.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
test.useTestNG()
当我进行清理时,出现以下异常
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/mac8/POS/MobilePosSolution/Generic-Integration/build.gradle' line: 2
* What went wrong:
Error resolving plugin [id: 'com.github.johnrengelman.shadow', version: '1.2.3']
> The response from https://plugins.gradle.org/api/gradle/2.14.1/plugin/use/com.github.johnrengelman.shadow/1.2.3 was not a valid response from a Gradle Plugin Resolution Service: content type is 'text/html;charset=iso-8859-1', expected 'application/json' (status code: 404)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.903 secs
如果我需要在我的 build.gradle 文件中更改某些内容以复制 shade 插件,请告诉我。
最佳答案
我只是试着打它,看起来它工作正常:
curl -v https://plugins.gradle.org/api/gradle/2.14.1/plugin/use/com.github.johnrengelman.shadow/1.2.3
* Trying 104.25.173.23...
* Connected to plugins.gradle.org (104.25.173.23) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 704 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_ECDSA_AES_128_GCM_SHA256
* server certificate verification OK
* server certificate status verification SKIPPED
* common name: ssl277771.cloudflaressl.com (matched)
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: EC
* certificate version: #3
* subject: OU=Domain Control Validated,OU=PositiveSSL Multi-Domain,CN=ssl277771.cloudflaressl.com
* start date: Sat, 06 Aug 2016 00:00:00 GMT
* expire date: Sun, 05 Feb 2017 23:59:59 GMT
* issuer: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO ECC Domain Validation Secure Server CA 2
* compression: NULL
* ALPN, server accepted to use http/1.1
> GET /api/gradle/2.14.1/plugin/use/com.github.johnrengelman.shadow/1.2.3 HTTP/1.1
> Host: plugins.gradle.org
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 24 Aug 2016 09:24:42 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< Set-Cookie: __cfduid=d0c64c916428b3abd24c29d0578251d2d1472030681; expires=Thu, 24-Aug-17 09:24:41 GMT; path=/; domain=.gradle.org; HttpOnly
< Via: 1.1 vegur
< Server: cloudflare-nginx
< CF-RAY: 2d75c0b211512378-FRA
<
{
"id" : "com.github.johnrengelman.shadow",
"version" : "1.2.3",
"implementation" : {
"gav" : "com.github.jengelman.gradle.plugins:shadow:1.2.3",
"repo" : "https://plugins.gradle.org/m2"
},
"implementationType" : "M2_JAR",
"legacy" : true
* Connection #0 to host plugins.gradle.org left intact
试试看会发生什么。
---编辑
只需将它添加到一个示例项目中,文件就可以正常下载。我还使用了 jcenter()
依赖库。
Download https://jcenter.bintray.com/com/github/jengelman/gradle/plugins/shadow/1.2.3/shadow-1.2.3.jar
将其添加到您的 build.gradle 文件中并尝试
buildscript {
repositories {
jcenter()
}
}
关于java - Gradle 影子插件失败 : Error resolving plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39118626/
我正在尝试创建一个邻接列表,为此我需要创建一个链接列表的数组列表。当我这样做时,这个 cityList 的大小不会更改为构造函数中传递的大小。我觉得这可能是由于阴影造成的,但我不确定阴影是如何工作的,
我正在包装应用程序的影子 jar 。该应用程序使用kotlin和一些外部依赖项。所有依赖项都在我的jar中,但在运行时出现以下异常: java.lang.NoSuchMethodError: java
我有两个自定义元素 #shadow-root (open) 我正在尝试设计 像这样: #desktop::shadow desktop-window { backgro
通过此实例化的 Web 组件样式不正确: connectedCallback() { const shadowRoot = this.attachShadow({ mode: 'open' });
规范在这里 - https://drafts.csswg.org/css-scoping/#slots-in-shadow-tree有注释如下。 Note: A non-obvious result
我在我的应用程序中使用网络组件。在 Web 组件中,我需要插入一个 React 组件。 Web Component 有 Shadow DOM。当我尝试使用以下方法渲染 react 组件时,出现错误。
CSS Scoping说 The descendants of a shadow host must not generate boxes in the formatting tree. Instea
在尝试比较两个 dll 的 API 更改时,一位同事注意到某些类有两个 GetType() 方法。 经过更深入的检查,结果是 System.Exception 隐藏了 GetType(): // th
HTML代码: #shadow-root (user-agent) "this is text in textarea" 我正在尝试使用此 JQuery 使用 id="in
我正在使用 Robolectric 并尝试创建 GoogleApiClient 的 Shadow 对象,但没有成功。 Shadow 类中的方法永远不会被调用。 GoogleApiClient 是接口(
我正在尝试寻找一种不使用 iframe 来封装 Javascript 的方法。理想情况下,我想要一种在父页面上加载外部 HTML 组件(小部件)的方法,而无需使用 iframe 附带的两步加载过程(首
我是Gradle和Shadow jar(Gradle version of Maven's Shade plugin)的新手。我正在构建一个胖jar,我想在其中合并服务文件(这就是为什么我首先使用影子
如您所见,我想动态添加内容,但 shadow DOM 不显示内容 我怎样才能使内容可见?我想让内容可见。 let shadow = document.querySelector('#nameTag')
我正在编写一个 chrome 扩展程序,它可以在页面加载或更改时修改元素属性。 我使用 Mutation Observer 执行此操作。然而,当加载/更改 shadow-dom(即嵌入的 twitte
我试图了解单选按钮如何在影子 dom 中工作。我有一个脚本标签,我将一个影子 DOM 附加到一个元素,然后附加一些单选按钮。我的问题是单选按钮未呈现。 Title Radi
我读了很多关于 shadow DOM 的文章,但对此不是很清楚。能谁能告诉我什么是 shadow DOM 以及如何为下面的代码添加一个? 最佳答案 Shadow DOM
关于 的 CSS 优先级规则是怎么说的?影子 DOM 中的标签? 我有一个元素 , 中包含的 CSS 文件与: component { display: inline-block; }
如果我的 Web 组件是 的直接子组件,我必须对它应用特殊的 CSS 样式。元素。到目前为止,这是我尝试过的: /* applies even if the component isn't a di
我尝试使用 https://github.com/webcomponents/webcomponentsjs 中的 polyfill 制作我自己的 Web 组件 这是我的代码: im-list.htm
我是一名优秀的程序员,十分优秀!