【发布时间】:2019-01-29 15:20:11
【问题描述】:
我有一个我正在从事的项目的微服务架构,最近我使用的是 Eclipse STS,每当我运行我的一个应用程序微服务时 我使用上下文菜单中的作为 spring boot 应用程序运行
昨天我想试验 Visual Studio Code,所以为了运行我的应用程序,我尝试使用 .\mvnw 或 mvn spring-boot:run 使用 powershell 终端,但不幸的是,在我的一项服务上,它运行不正确,我有以下异常
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at demo.ClientApplication.main(ClientApplication.java:70)
所需项目有以下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>mds.group</groupId>
<artifactId>MDS-Facture-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MDS-Facture-client</name>
<description>Client Web de la facturation</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.SR2</spring-cloud.version>
<thymeleaf.version>3.0.6.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.2.1</thymeleaf-layout-dialect.version>
</properties>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.4.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mds</groupId>
<artifactId>data-shema</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我应该怎么做才能从 vs-code 作为 maven 命令运行来解决这个问题? (以另一种方式重现 STS 用来成功启动我的应用程序的生成的 maven 命令)
在 ugur 评论之后,我尝试了 mvn clean compile 我遇到以下编译错误
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/notification/NotificationRestMediator.java:[10,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/notification/NotificationRestMediator.java:[11,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/notification/NotificationRestMediator.java:[19,17] cannot find symbol
symbol: class NotifFeignClient
location: class demo.notification.NotificationRestMediator
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/notification/NotificationRestMediator.java:[22,14] cannot find symbol
symbol: class NotificationDTO
location: class demo.notification.NotificationRestMediator
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[15,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[16,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[25,17] cannot find symbol
symbol: class ProductFeignClient
location: class demo.produit.ProduitRestMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[34,43] cannot find symbol
symbol: class ProduitEditDTO
location: class demo.produit.ProduitRestMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[42,14] cannot find symbol
symbol: class ProduitEditDTO
location: class demo.produit.ProduitRestMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[48,41] cannot find symbol
symbol: class ProduitEditDTO
location: class demo.produit.ProduitRestMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[17,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[18,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[19,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[20,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[21,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[35,17] cannot find symbol
symbol: class AppClientFeign
location: class demo.LandingController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[38,17] cannot find symbol
symbol: class UserClientFeign
location: class demo.LandingController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/company/CompanyController.java:[12,25] package com.mds.shema.dto does
not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/company/CompanyController.java:[20,80] cannot find symbol
symbol: class CompanySettingQuickFormDTO
location: class demo.company.CompanyController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/company/CompanyController.java:[28,42] cannot find symbol
symbol: class CompanySettingQuickFormDTO
location: class demo.company.CompanyController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[16,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[17,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[33,17] cannot find symbol
symbol: class RefClientFeign
location: class demo.refclient.RefClientMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[36,60] cannot find symbol
symbol: class AddClientDTO
location: class demo.refclient.RefClientMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[56,61] cannot find symbol
symbol: class AddClientDTO
location: class demo.refclient.RefClientMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/printer/PrintController.java:[20,26] package com.mds.shema.json does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/printer/PrintController.java:[74,64] cannot find symbol
symbol: class ClientJsonDto
location: class demo.printer.PrintController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/ClientApplication.java:[21,21] package com.mds.shema does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorRestController.java:[12,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorRestController.java:[13,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorRestController.java:[22,17] cannot find symbol
symbol: class RefClientFeign
location: class demo.refclient.RefClientMediatorRestController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorRestController.java:[25,29] cannot find symbol
symbol: class ClientDTO
location: class demo.refclient.RefClientMediatorRestController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/ClientApplication.java:[54,44] cannot find symbol
symbol: class DemoApplication
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/ClientApplication.java:[56,64] cannot find symbol
symbol: class DemoApplication
[INFO] 34 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.912 s
[INFO] Finished at: 2019-01-29T16:56:37+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project MDS-Facture-client: Compilation failure: Compilation failure:
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/notification/NotificationRestMediator.java:[10,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/notification/NotificationRestMediator.java:[11,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/notification/NotificationRestMediator.java:[19,17] cannot find symbol
[ERROR] symbol: class NotifFeignClient
[ERROR] location: class demo.notification.NotificationRestMediator
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/notification/NotificationRestMediator.java:[22,14] cannot find symbol
[ERROR] symbol: class NotificationDTO
[ERROR] location: class demo.notification.NotificationRestMediator
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[15,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[16,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[25,17] cannot find symbol
[ERROR] symbol: class ProductFeignClient
[ERROR] location: class demo.produit.ProduitRestMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[34,43] cannot find symbol
[ERROR] symbol: class ProduitEditDTO
[ERROR] location: class demo.produit.ProduitRestMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[42,14] cannot find symbol
[ERROR] symbol: class ProduitEditDTO
[ERROR] location: class demo.produit.ProduitRestMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/produit/ProduitRestMediatorController.java:[48,41] cannot find symbol
[ERROR] symbol: class ProduitEditDTO
[ERROR] location: class demo.produit.ProduitRestMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[17,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[18,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[19,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[20,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[21,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[35,17] cannot find symbol
[ERROR] symbol: class AppClientFeign
[ERROR] location: class demo.LandingController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/LandingController.java:[38,17] cannot find symbol
[ERROR] symbol: class UserClientFeign
[ERROR] location: class demo.LandingController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/company/CompanyController.java:[12,25] package com.mds.shema.dto does
not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/company/CompanyController.java:[20,80] cannot find symbol
[ERROR] symbol: class CompanySettingQuickFormDTO
[ERROR] location: class demo.company.CompanyController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/company/CompanyController.java:[28,42] cannot find symbol
[ERROR] symbol: class CompanySettingQuickFormDTO
[ERROR] location: class demo.company.CompanyController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[16,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[17,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[33,17] cannot find symbol
[ERROR] symbol: class RefClientFeign
[ERROR] location: class demo.refclient.RefClientMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[36,60] cannot find symbol
[ERROR] symbol: class AddClientDTO
[ERROR] location: class demo.refclient.RefClientMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorController.java:[56,61] cannot find symbol
[ERROR] symbol: class AddClientDTO
[ERROR] location: class demo.refclient.RefClientMediatorController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/printer/PrintController.java:[20,26] package com.mds.shema.json does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/printer/PrintController.java:[74,64] cannot find symbol
[ERROR] symbol: class ClientJsonDto
[ERROR] location: class demo.printer.PrintController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/ClientApplication.java:[21,21] package com.mds.shema does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorRestController.java:[12,27] package com.mds.shema.Feign does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorRestController.java:[13,25] package com.mds.shema.dto does not exist
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorRestController.java:[22,17] cannot find symbol
[ERROR] symbol: class RefClientFeign
[ERROR] location: class demo.refclient.RefClientMediatorRestController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/refclient/RefClientMediatorRestController.java:[25,29] cannot find symbol
[ERROR] symbol: class ClientDTO
[ERROR] location: class demo.refclient.RefClientMediatorRestController
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/ClientApplication.java:[54,44] cannot find symbol
[ERROR] symbol: class DemoApplication
[ERROR] /C:/Users/win 10/Documents/Google Drive/cloud server oauth2/clientFactureMS/src/main/java/demo/ClientApplication.java:[56,64] cannot find symbol
[ERROR] symbol: class DemoApplication
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
编译器似乎无法识别我添加的 data-shema 依赖项
所以我关闭这个线程并打开另一个如果我不解决这个问题
【问题讨论】:
-
你确定你的代码在编译之前没有错误吗?.. 当你通过 VS 代码运行这个版本时,它可以工作吗?
-
也许你可以尝试 mvn clean compile 然后再次运行
-
@Mark 当我使用 Eclipse STS 时,我确实运行了我的应用程序,我可以打印并执行我去年为此开发的每一项任务,我确信没有代码错误,从 eclipse 运行但从 vsc 无法使用 shell
-
@ugur 感谢异常已更改
-
你是不是通过
com.mds.shema之类的VS代码手动添加依赖,而没有添加到pom.xml中?
标签: java spring maven spring-boot