我已经构建了一个maven项目。在build.xml中包含了使用另一个pom导入的所有测试依赖项。 当我试图将maven项目A包括在Gradle项目B中时 它给出了错误。
我尝试[ - info]首先尝试正确的存储库URL并更新jar [缓存资源是最新的]。但最后它会尝试其他人并抛出错误。
如何传递配置文件名表格gradle构建文件?
非常感谢。
项目A - > Maven Build - pom.xml
<groupId>com.spring.test</groupId>
<artifactId>Rest</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Project</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<JUnitBOM.version.number>1.0.0</JUnitBOM.version.number>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<!-- Components -->
<dependency>
<groupId>com.test</groupId>
<artifactId>JUnitBOM</artifactId>
<version>${JUnitBOM.version.number}-${project.qualifier}
</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<profile>
<id>AUAT</id>
<properties>
<env>uat</env>
<project.qualifier>SNAPSHOT</project.qualifier>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
项目B - &gt; gradle build - build.gradle
apply plugin: 'java'
apply plugin: 'maven'
group = "com.spring.integration"
status = 'integration'
version = '1.0.0'
sourceCompatibility = 1.7
repositories {
maven { url "http://repo1" }
maven { url "http://maven.springframework.org/release" }
maven { url "http://maven.restlet.org" } }
dependencies {
compile group:'com.spring.test', name:'Rest', version:'1.0.0-SNAPSHOT', classifier: 'AUAT'
compile group:'org.restlet.jee', name:'org.restlet', version:'2.2'
compile group:'org.restlet.jee', name:'org.restlet.ext.servlet',version:'1.1'
compile group:'org.springframework', name:'spring-web', version:'3.2.1.RELEASE'
compile group:'org.slf4j', name:'slf4j-api', version:'1.7.2'
compile group:'ch.qos.logback', name:'logback-core', version:'1.0.9'
testCompile group:'junit', name:'junit', version:'4.11'
}
错误消息
Could not resolve all dependencies for configuration ':compile'.
> Could not resolve com.spring.test:Rest:1.0.0-SNAPSHOT.
Required by:
com.spring.test:0.1.0-SNAPSHOT
> Could not resolve com.test:JUnitBOM:1.0.0-${project.qualifier}.
> java.lang.IllegalArgumentException (no error message)
> java.lang.IllegalArgumentException (no error message)
> java.lang.IllegalArgumentException (no error message)
> Could not HEAD 'http://maven.restlet.org/com/spring/test/Rest/1.0.0-SNAPSHOT/Rest-1.0.0-SNAPSHOT.pom'. Received status code 409 from server: Conflict
答案 0 :(得分:1)
您可以使用Gradle maven设置插件https://plugins.gradle.org/plugin/net.linguica.maven-settings。 使用maven设置插件,您可以传递activeProfiles,自定义maven设置文件。