Tenho um projeto maven que tem os seguintes subprojetos:
- Web - WAR
- Util - JAR
- DAO - JAR
- Modelo - JAR
- Servico - JAR
POM do web.
<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> <parent> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft</artifactId> <version>0.0.9-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>netsoft-web</artifactId> <name>netsoft-web</name> <description>Projeto Web para projetos que usam a arquitetura GH Sistemas - Contem as classes de Rest Controller</description> <organization> <url>www.ghsistemas.com.br</url> <name>GH Sistemas</name> </organization> <dependencies> <dependency> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft-modelo</artifactId> <version>${netsoft-version}</version> </dependency> <dependency> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft-servico</artifactId> <version>${netsoft-version}</version> </dependency> <dependency> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft-util</artifactId> <version>${netsoft-version}</version> </dependency> <dependency> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft-ws</artifactId> <version>${netsoft-version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring-webmvc.version}</version> </dependency> <!-- Jackson - JSON --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jackson-core.version}</version> </dependency> <!-- Servlet API --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>${servlet.version}</version> <scope>provided</scope> </dependency> <!-- Upload --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>${commons-fileupload.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> <version>${spring-boot-starter-mail.version}</version> </dependency> <dependency> <groupId>org.modelmapper</groupId> <artifactId>modelmapper</artifactId> <version>${modelmapper.version}</version> </dependency> <!-- Spring security --> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> <version>${spring-security.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> <version>${spring-security.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> <version>${spring-security-starter.version}</version> </dependency> <dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId>spring-security-oauth2</artifactId> <version>${spring-security-oauth2.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-jwt</artifactId> <version>${spring-security-jwt.version}</version> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>${jjwt.version}</version> </dependency> <!-- Base 64 --> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>${commons-codec.version}</version> </dependency> </dependencies> </project>
Pom do projeto DAO
<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> <parent> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft</artifactId> <version>0.0.9-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>netsoft-dao</artifactId> <name>netsoft-dao</name> <description>Projeto DAO para projetos que usam a arquitetura GH Sistemas - Contem as classes e recursos vinculados a tecnologia e APIs exclusivas do projeto</description> <organization> <url>www.ghsistemas.com.br</url> <name>GH Sistemas</name> </organization> <dependencies> <dependency> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft-modelo</artifactId> <version>${netsoft-version}</version> </dependency> <dependency> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft-util</artifactId> <version>${netsoft-version}</version> </dependency> <!-- Bean Validation / Hibernate Validator --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>${hibernate-validator.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${hibernate-core.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring-webmvc.version}</version> </dependency> </dependencies> </project>
POM do projeto serviço
<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> <parent> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft</artifactId> <version>0.0.9-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>netsoft-servico</artifactId> <name>netsoft-servico</name> <description>Projeto Negocio para projetos que usam a arquitetura GH Sistemas - Contem as classes de controle e fronteira, conforme padrao ECB – Entity-Control-Boundary</description> <organization> <url>www.ghsistemas.com.br</url> <name>GH Sistemas</name> </organization> <dependencies> <dependency> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft-modelo</artifactId> <version>${netsoft-version}</version> </dependency> <dependency> <groupId>br.eti.netsoft</groupId> <artifactId>netsoft-dao</artifactId> <version>${netsoft-version}</version> </dependency> <!-- Spring security --> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> <version>${spring-security.version}</version> </dependency> </dependencies> </project>
O projeto web tem dependência do projeto service e o projeto service tem dependência do projeto DAO, pelo que entendi.
Dentro do WEB, consigo acessar o DAO, sem passar pelo Servico, o que não seria o certo. Como ajustar para que este subprojeto não acesse diretamente as classes do projeto DAO ?