有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java运行Spring应用程序问题

我有一个用于我正在研究的项目的微服务体系结构,最近我在使用Eclipse STS,每当我运行我的一个应用程序微服务时,我都会从上下文菜单中使用run as spring boot应用程序

昨天我想尝试Visual Studio代码,所以为了运行我的应用程序,我尝试使用.\mvnwmvn 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代码作为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依赖项 所以如果我不解决这个问题,我会关闭这个线程并打开另一个线程


共 (1) 个答案

  1. # 1 楼答案

    我使用SharedCode项目在我的微服务之间共享我的外部客户机和dto。问题是,在共享代码中,我使用了spring boot v 2。x、 在这个版本中,我使用了伪依赖项,但没有指定版本,所以spring使用了最新版本的与spring boot 2兼容的伪依赖项。x、 x

    因为我在上一个外文版本中,所以在设置外文请求方法时,param值不是必需的

    但由于我的SharedCode使用maven pom依赖项链接到我的其他微服务,我犯了一个错误,在spring boot 1.5.6上创建了我的微服务,并添加了所有需要的扫描和类配置

    这里我得到了错误,因为当spring扫描外部客户机时,它将使用当前的项目版本,在该版本中,任何导致编译问题的请求签名都必须使用外部参数值,而这从来不是单独在SharedCode项目编译中抛出的