这是针对大型构建的Maven-to-Gradle构建转换。想想Rodan,Ghidora,哥斯拉等等。是的。那么大。
给定如下依赖:
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("User Name", "loginName"));
nameValuePairs.add(new BasicNameValuePair("Password", "loginPassword"));
nameValuePairs.add(new BasicNameValuePair("FromUser", sEmail));
nameValuePairs.add(new BasicNameValuePair("CommentsTo", sEmail));
nameValuePairs.add(new BasicNameValuePair("MyVersion", MainActivity.version));
httpclient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
new UsernamePasswordCredentials("loginCredentials", "loginPasswordCredentials");
ResponseHandler<String> responseHandler = new BasicResponseHandler();
HttpPost httpPost = new HttpPost("https://hostingservername/hostingserverdirectory/PHPhandlerfile.php");
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpEntity entity = httpPost.getEntity();
sReceiveResponse = httpclient.execute(httpPost, responseHandler);
if( entity != null ) entity.consumeContent(); // release connection
// handle sReceiveResponse return
如何从上面排除项目?我尝试了以下的变体:
ext.jbossBom = [ ... ]// This is in the root project.
compile (rootProject.ext.jbossBom) //This is not in the root project
答案 0 :(得分:3)
jbossBom
是一个集合。删除您想要消除的元素:
compile (rootProject.ext.jbossBom.findAll{ !it.startsWith('some.group')})
要全局排除某个传递依赖(无论哪个依赖项带入),您可以执行以下操作:
configurations {
compile.exclude group: 'commons-math3', module: 'commons-math3'
compile.exclude group: 'commons-pool2', module: 'commons-pool2'
}
要从jbossBom
的每个内容中排除特定的传递依赖关系,您可以执行以下操作:
dependencies{
jbossBom.each{
compile (it){exclude group:'foo', module:'bar'}
}
}