我已经在我的机器上安装了maven.我已正确设置class-path和maven主文件夹.每次执行时mvn clean install,都会让我异常.我也尝试删除.m2文件夹,但结果相同.
mvn -version输出
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
Maven home: C:\maven-3
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: D:\jdk170_45\jre
Default locale: en_US, platform encoding: MS950
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
Run Code Online (Sandbox Code Playgroud)记录mvn -X clean install
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
Maven home: C:\maven-3
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: D:\jdk170_45\jre
Default locale: en_US, platform encoding: MS950
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
[DEBUG] …Run Code Online (Sandbox Code Playgroud)我已经构建了一个类和配置文件的jar文件.configuration.yml文件位于jar的根目录中.当我尝试使用以下命令运行应用程序时:
java -jar target/drop-wizard-0.0.1-SNAPSHOT.jar server configuration.yml
Run Code Online (Sandbox Code Playgroud)
我在下面得到了例外.如何从命令提示符指定位于jar中的文件?
Exception in thread "main" java.io.FileNotFoundException: File configuration.yml not found <br>
at io.dropwizard.configuration.FileConfigurationSourceProvider.open(FileConfigurationSourceProvider.java:14)<br>
at io.dropwizard.configuration.ConfigurationFactory.build(ConfigurationFactory.java:75)<br>
at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:114)<br>
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:63)<br>
at io.dropwizard.cli.Cli.run(Cli.java:70)<br>
at io.dropwizard.Application.run(Application.java:72)<br>
at com.flightnetwork.dropwizard.example.HelloWorldApplication.main(HelloWorldApplication.java:10)<br>
Run Code Online (Sandbox Code Playgroud) 创建了一个Spring Boot应用程序示例项目以了解伪客户端功能,在运行时会出现以下错误。
说明:com.example.demo.RestClient中的字段remoteCallClient需要一个类型为com.example.demo.RemoteCallClient的bean。行动:考虑在您的配置中定义一个类型为“ com.example.demo.RemoteCallClient”的bean。
我提供了示例项目的完整源代码,尝试了各种方法,但是都无法解决。
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>com.example</groupId>
<artifactId>mictro-service-3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>micro-service-3</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.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>Finchley.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-feign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
<version>1.4.5.RELEASE</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version> …Run Code Online (Sandbox Code Playgroud) spring-boot netflix-feign spring-cloud-feign feign spring-cloud-netflix
dropwizard ×1
feign ×1
java ×1
java-ee ×1
maven ×1
maven-2 ×1
maven-3 ×1
maven-plugin ×1
spring-boot ×1