我无法编辑这个项目,甚至做所有必要的倾诉,但不幸的是,没有成功。
我成功地编译了第一个交换核心!使用此命令:
mvn install这是另一个项目工作所需的依赖项。
之后,我找到了目标文件夹,并启动了以下命令:
mvn install:install-file -Dfile=exchange-core-0.5.4-SNAPSHOT.jar -DgroupId=exchange.core2 -DartifactId=exchange-core -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -DgeneratePom=true这样,我就可以让其他项目可以访问依赖项。
但是当试图编译网关(将使用第一次编译的项目)时,我会得到这个错误!
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Exchange REST Gateway 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ exchange-gateway-rest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 9 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ exchange-gateway-rest ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 62 source files to /build/exchange-gateway/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/controllers/SyncTradeMiscApiController.java:[26,33] package org.jetbrains.annotations does not exist
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/RestGatewayApplication.java:[20,37] cannot find symbol
symbol: class OrderBookFastImpl
location: package exchange.core2.core.orderbook
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/RestGatewayApplication.java:[21,50] package exchange.core2.core.processors.journalling do
es not exist
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/RestGatewayApplication.java:[31,52] cannot find symbol
symbol: class ThreadAffinityMode
location: class exchange.core2.core.utils.UnsafeUtils
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/RestGatewayApplication.java:[31,1] static import only from classes and interfaces
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/controllers/SyncTradeMiscApiController.java:[64,6] cannot find symbol
symbol: class NotNull
location: class exchange.core2.rest.controllers.SyncTradeMiscApiController
[INFO] 6 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.359 s
[INFO] Finished at: 2020-07-02T20:13:06Z
[INFO] Final Memory: 35M/85M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project exchange-gateway-rest: Compilation
failure: Compilation failure:
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/controllers/SyncTradeMiscApiController.java:[26,33] package org.jetbrains.annotations doe
s not exist
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/RestGatewayApplication.java:[20,37] cannot find symbol
[ERROR] symbol: class OrderBookFastImpl
[ERROR] location: package exchange.core2.core.orderbook
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/RestGatewayApplication.java:[21,50] package exchange.core2.core.processors.journalling do
es not exist
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/RestGatewayApplication.java:[31,52] cannot find symbol
[ERROR] symbol: class ThreadAffinityMode
[ERROR] location: class exchange.core2.core.utils.UnsafeUtils
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/RestGatewayApplication.java:[31,1] static import only from classes and interfaces
[ERROR] /build/exchange-gateway/src/main/java/exchange/core2/rest/controllers/SyncTradeMiscApiController.java:[64,6] cannot find symbol
[ERROR] symbol: class NotNull
[ERROR] location: class exchange.core2.rest.controllers.SyncTradeMiscApiController
[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此错误:
package org.jetbrains.annotations does not exist可以通过添加我认为的jetbrains依赖项来解决,或者从文件中删除它。
但其他人呢?
cannot find symbol
[ERROR] symbol: class OrderBookFastImpl
[ERROR] location: package exchange.core2.core.orderbook知道此依赖项来自第一个项目。
我使用的是带图像的码头:maven:3.5.2-jdk-8-alpine
关于github的项目
项目1(交换核心):https://github.com/mzheravin/exchange-core
项目2(交换网关):https://github.com/exchange-core/exchange-gateway-rest
第二个项目的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>exchange.core2</groupId>
<artifactId>exchange-gateway-rest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Exchange REST Gateway</name>
<description>Java Exchange Market Gateway</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/>
</parent>
<properties>
<skip.it>false</skip.it>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<guava.version>25.0-jre</guava.version>
<commons-math3.version>3.6.1</commons-math3.version>
<commons-lang3.version>3.7</commons-lang3.version>
<HikariCP.version>3.1.0</HikariCP.version>
<eclipse.collections.version>9.2.0</eclipse.collections.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>${commons-math3.version}</version>
</dependency>
<!-- Eclipse (Goldman Sachs) collections -->
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections-api</artifactId>
<version>9.2.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections</artifactId>
<version>9.2.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>exchange.core2</groupId>
<artifactId>exchange-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-core</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>sockjs-client</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>stomp-websocket</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- DATABASE PERSISTENCE -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-java8</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${HikariCP.version}</version>
</dependency>
<!-- Eclipse (Goldman Sachs) collections -->
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections</artifactId>
</dependency>
<!-- tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>it</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration combine.self="override">
<!--<argLine>-XX:+PrintApplicationStoppedTime</argLine>-->
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<includes>
<include>**/IT*.java</include>
<include>**/*IntegrationTest.java</include>
</includes>
<excludes>
<exclude>**/remote/**/*.class</exclude>
<exclude>**/stress/**/*.class</exclude>
<exclude>**/*Remote*Test.java</exclude>
<exclude>**/*Stress*Test.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>我们从这一行中将本地依赖称为:
<dependency>
<groupId>exchange.core2</groupId>
<artifactId>exchange-core</artifactId>
<version>0.5.4-SNAPSHOT</version> //<-- changed the version here to the current one
</dependency>发布于 2020-07-04 01:56:34
我克隆了你的git存储库。
在您的OrderBookFastImpl项目中没有exchange-core类。
发布于 2020-07-03 02:34:27
看看这个:在mvn install:install-file命令中,您编写了version=0.0.1-SNAPSHOT,而在pom.xml中,我看到了<version>0.5.4-SNAPSHOT</version>。
https://stackoverflow.com/questions/62706687
复制相似问题