2
I have this Maven project that has all the application domain classes and logic. Then I created an external Gradle test project where I do system testing with Selenium Webdriver.
In order not to have to add all the domain classes in my Gradle project, I would like to add Maven to the dependencies, but when running the test project, it launches several errors in all the classes I use the domains.
The main issue is: how to add the Maven project as dependency on the Gradle project?
I’ve tried to put
repositories {
mavenLocal()
maven { url "../meuProjetoMaven" }
in the build.Radle and
dependencies {
compile "br:meuProjetomaven"
but it gives me this exit:
Could not resolve all files for Configuration ':testCompileClasspath'.
Could not find br:meuProjetomaven:. Searched in the following Locations: file:/C:/Users/pedro/. m2/Repository/br/meuProjetomaven//meProjetomaven-.pom file:/C:/Users/pedro/. m2/Repository/br/meuProjetomaven//meProjetomaven-.jar file:/C:/Users/pedro/git/projeto/br/meuProjetomaven//meuProjetomaven-.pom file:/C:/Users/pedro/git/projeto/br/meuProjetomaven//meuProjetomaven-.jar
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>br</groupId>
<artifactId>meuProjetomaven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>meuProjetomaven</name>
<description>Descricao</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
<project.reporting.outputEncoding>ISO-8859-1</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>br</groupId>
<artifactId>package-release-framework</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
build.Gradle
/*
Script de build dos testes para o meuProjetoMaven
**/
/********************************** Repositórios *****************************************/
buildscript {
repositories {
mavenLocal()
maven { url "http://SomeRepo.com/artifactory/libs-release" }
maven { url "http://SomeRepo.com/artifactory/libs-snapshot" }
}
dependencies {
classpath 'br:automacao-gradle:0.1.1'
}
}
repositories {
mavenLocal()
maven { url "http://SomeRepo.com/artifactory/libs-release" }
maven { url "http://SomeRepo.com/artifactory/libs-snapshot" }
}
/*********************************** Build ***********************************************/
apply plugin: 'java'
apply plugin: 'br.automacao-gradle'
dependencies {
testCompile "br:automacao-core:0.1.0"
//compile "br:myMavenProject" << esta linha está comentada pois foi de uma tentativa que não deu certo de utilizar
}
sourceSets{
main{
java.srcDirs = []
}
test{
java.srcDirs = ['src', 'testes']
resources.srcDirs = ['test-resources']
}
}
You can edit the question and post the
pom.xml
and thebuild.gradle
complete?– Victor Stafusa
@Victorstafusa made
– Pedro Henrique
Is there a reason you use Maven and Gradle instead of just Gradle?
– Victor Stafusa
@Victorstafuses the Maven project is a project the part the team is developing. Gradle is because the base framework I use to develop the tests is done in Gradle.
– Pedro Henrique
What is
br.automacao-gradle
andbr:automacao-core
?– Victor Stafusa
the dependencies of the test automation framework
– Pedro Henrique