I see a lot of questions about stackoverflow. But still I can’t understand what the problem is in my way of creating projects.
I have two spring boot projects: we-data and we-web. we-web depends on we data. we-data are compiled on maven. But we-web gives me the error above.
we-data pom:
<?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>com.we</groupId> <artifactId>data</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>we-data</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.2.RELEASE</version> <relativePath /> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
we-web pom:
<?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>com.we</groupId> <artifactId>web</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>we-web</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.2.RELEASE</version> <relativePath /> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.we</groupId> <artifactId>data</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
Every time I do maven "clean compile installation package" on we-web, I get a maven error. All the characters that complains are not found, we are all in the data project. For some reason, he says that all we data classes cannot be found on we-web. But when I run the application as a spring boot application, everything is fine. There is no maven error for this:
[INFO] ------------------------------------------------------------------------ [INFO] Building we-web 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ web --- [INFO] Deleting C:\Users\user\Documents\GitHub\we\we-web\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ web --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ web --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 10 source files to C:\Users\user\Documents\GitHub\we\we-web\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /C:/Users/user/Documents/GitHub/we/we-web/src/main/java/com/we/controller/EmployeeController.java:[13,25] package com.we.service does not exist [ERROR] /C:/Users/user/Documents/GitHub/we/we-web/src/main/java/com/we/controller/EmployeePaymentController.java:[22,9] cannot find symbol symbol: class EmployeeService location: class com.we.controller.EmployeePaymentController . . . [INFO] 44 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.322 s [INFO] Finished at: 2016-12-26T15:30:54+05:30 [INFO] Final Memory: 26M/253M [INFO] ------------------------------------------------------------------------ [WARNING] The requested profile "pom.xml" could not be activated because it does not exist. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project web: Compilation failure: Compilation failure: . .
I have a 1.8 jdk used by STS. And also I did not put the we-data project on the build path for we-web. I want this to go away because I want to spawn a war. Please help. I do a “clean compilation package build” on we data and then do it on we-web. "Update maven project" also does not help me.
source share