在我的日食中,有很多项目都是用gradle构建的。我想跳过gradle中的testRuntime任务。因为它太慢了,只要我改变一些代码或改变项目,就会等待很长时间。我怎么能避免这个?我想申请所有相关项目。
更新
这是gradle任务的结果。 Eclipse正在执行后台作业,我在进程选项卡中检查这些作业,我可以看到如下消息。
在xxx项目上构建Gradle
执行任务:xxxx:TestRuntime
我认为由于防火墙需要时间。我想跳过这个过程。我想,可以通过eclipse或gradle配置来完成。
我的build.gradle文件
buildscript {
repositories {
mavenLocal()
maven { // for thridparty lib
url 'http://70.121.244.11:8081/nexus/content/groups/openpms-public'
credentials {
username 'openpms'
password 'openpms0'
}
}
maven { // for thridparty lib
url 'http://70.121.244.11:8081/nexus/content/repositories/thirdparty'
credentials {
username 'developer'
password 'developer0'
}
}
maven { url 'http://70.121.224.52:8081/nexus/content/repositories/central/' }
jcenter{ url 'http://70.121.224.52:8081/nexus/content/repositories/jcenter/' }
}
dependencies {
classpath "org.akhikhl.gretty:gretty:$gretty_version"
}
}
repositories {
mavenLocal()
maven {
url 'http://70.121.244.11:8081/nexus/content/groups/openpms-public'
credentials {
username "$maven_username"
password "$maven_password"
}
}
maven { // for thridparty lib
url 'http://70.121.244.11:8081/nexus/content/repositories/thirdparty'
credentials {
username 'developer'
password 'developer0'
}
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'org.akhikhl.gretty'
sourceCompatibility = 1.6
targetCompatibility = 1.6
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' // compileGroovy, compileTestGroovy
def spring_version = '4.0.6.RELEASE'
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
compile group: 'org.opensymphony.quartz', name: 'quartz', version: '1.6.1'
compile group: 'commons-logging', name: 'commons-logging', version: '1.0.4'
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
}
gretty {
servletContainer = 'jetty8'
port = 8080
contextPath = '/agent.server'
}
更新2
[sts] -----------------------------------------------------
[sts] Starting Gradle build for the following tasks:
[sts] tasks
[sts] -----------------------------------------------------
<org.gradle.api.plugins.quality.PmdExtension_Decorated@729eaf4b __dyn_obj__=org.gradle.api.internal.AsmBackedClassGenerator$MixInExtensibleDynamicObject@2fc49256 __mapping__=org.gradle.api.internal.ConventionAwareHelper@1263649a __consoleOutput__=false __ignoreFailures__=true __reportsDir__=true __ruleSetConfig__=false __ruleSetFiles__=true __ruleSets__=true __sourceSets__=true __targetJdk__=false __toolVersion__=true project=root project 'redca-agent' ruleSets=[basic] targetJdk=null ruleSetConfig=null ruleSetFiles=file collection consoleOutput=false toolVersion=4.3 sourceSets=[source set 'main'] ignoreFailures=true reportsDir=D:\workspace\redCAGit\redca-agent\build\reports\pmd>
:tasks
------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------
Application tasks
-----------------
bootRun - Run the project with support for auto-detecting main class and reloading static resources
installApp - Installs the project as a JVM application along with libs and OS specific scripts.
run - Runs this project as a JVM application
Build tasks
-----------
assemble - Assembles the outputs of this project.
bootRepackage - Repackage existing JAR and WAR archives so that they can be executed from the command line using 'java -jar'
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles classes 'main'.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles classes 'test'.
Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]
Distribution tasks
------------------
assembleDist - Assembles the main distributions
distTar - Bundles the project as a distribution.
distZip - Bundles the project as a distribution.
installDist - Installs the project as a distribution as-is.
Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.
Help tasks
----------
components - Displays the components produced by root project 'redca-agent'. [incubating]
dependencies - Displays all dependencies declared in root project 'redca-agent'.
dependencyInsight - Displays the insight into a specific dependency in root project 'redca-agent'.
help - Displays a help message.
model - Displays the configuration model of root project 'redca-agent'. [incubating]
projects - Displays the sub-projects of root project 'redca-agent'.
properties - Displays the properties of root project 'redca-agent'.
tasks - Displays the tasks runnable from root project 'redca-agent' (some of the displayed tasks may belong to subprojects).
Verification tasks
------------------
check - Runs all checks.
test - Runs the unit tests.
Other tasks
-----------
findbugsTest - Run FindBugs analysis for test classes
pmdTest - Run PMD analysis for test classes
Rules
-----
Pattern: clean<TaskName>: Cleans the output files of a task.
Pattern: build<ConfigurationName>: Assembles the artifacts of a configuration.
Pattern: upload<ConfigurationName>: Assembles and uploads the artifacts belonging to a configuration.
To see all tasks and more detail, run gradle tasks --all
To see more detail about a task, run gradle help --task <task>
BUILD SUCCESSFUL
Total time: 2.354 secs
[sts] -----------------------------------------------------
[sts] Build finished succesfully!
[sts] Time taken: 0 min, 2 sec
[sts] -----------------------------------------------------
我想知道跳过工作testRuntime的方法。 即使不是任务,我的关注也不是浪费时间。 我怎么能避免这个?
答案 0 :(得分:1)
我是gradle的新手,我不会说英语。请理解。
无论如何,我自己解决了。我正在使用的Eclipse gradle插件正在尝试连接可能被防火墙阻止的Internet上的存储库。所以我无法解决这个问题。有许多工作场所,包括离线的地方。
我可以跳过这个,将参数提供给Program Arguments,如下所示。你可以在eclipse偏好中添加这个属性&gt; Gradle&gt;参数。
--offline