I have this Maven project that has all application domain classes and logic. From there I created an external Gradle test project where I do system tests with Selenium WebDriver.
To not need to add all the domain classes in my gradle project, I would like to add Maven to dependencies, but at the time of running the test project, it throws several errors in all classes that use the domains.
The main question is: how do I add the maven project as dependency in the gradle project?
I've tried to put
repositories {
mavenLocal()
maven { url "../meuProjetoMaven" }
in build.grad and
dependencies {
compile "br:meuProjetomaven"
but it gives me this output:
Could not resolve all files for configuration ': testCompileClasspath'.
Could not find br: myProjetomaven :. Searched in the following locations: file: / C: /Users/pedro/.m2/repository/br/meuProjetomaven//meuProjetomaven-.pom file: / C: /Users/pedro/.m2/repository/br/meuProjetomaven//meuProjetomaven-.jar file: / C: /Users/pedro/git/project/br/meuProjetomaven//meuProjetomaven-.pom file: / C: /Users/pedro/git/project/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']
}
}