我的gradle构建脚本中有一个依赖项:
apply plugin 'war'
dependencies {
compile 'com.github.jsimone:webapp-runner:7.0.22'
}在创建war时,任务createWebappRunnerJar是否可以从给定的远程源创建jar?
我在看http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.bundling.Jar.html,但我不认为它是用于远程源的。
webapp运行程序是内置在战争中的,如果不能从远程资源构建它,也许有办法将其复制到战争之外?
在maven中,以下内容也是如此:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>7.0.22</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>发布于 2014-08-28 17:24:53
您最好的选择是创建一个单独的配置,仅用于您打算作为远程源包括的依赖项,然后创建一个复制任务,将该配置复制到您选择的位置。
configurations {
remoteSources {
transitive false
}
}
dependencies {
remoteSources 'com.github.jsimone:webapp-runner:7.0.22'
}
task copyRemoteSources(type: Copy) {
from configurations.remoteSources
into "${project.buildDir}/remoteSources"
}https://stackoverflow.com/questions/25548874
复制相似问题