maven 相关问题

Apache Maven是一个构建自动化和项目管理工具,主要用于Java项目。此标记用于与特定Maven版本无关的问题。使用gradle标签代替与Gradle相关的问题。

Maven 编译器插件无法解析包含物料清单 (bom) 中指定版本的 Maven 依赖关系

我们目前为所有项目(库和微服务)配置了此物料清单 (bom) maven 编译器插件 我们目前为所有项目(库和微服务)配置了此物料清单 (bom) <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin.version}</version> <configuration> <source>${maven.compiler.source}</source> <target>${maven.compiler.target}</target> <annotationProcessorPaths> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </path> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> </path> <path> <groupId>org.hibernate</groupId> <artifactId>hibernate-jpamodelgen</artifactId> </path> </annotationProcessorPaths> </configuration> </plugin> ... 我们有一个父 pom,在其中定义包含此 bom 的所有微服务的常见行为。 <dependencyManagement> <dependencies> <dependency> <groupId>nl.bro</groupId> <artifactId>jakarta.bro-bill-off-material</artifactId> <version>${bro-bill-off-material.version}</version> <type>pom</type> <scope>import</scope> </dependency> ... 在文件中我们定义了 build.plugins.plugin <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin.version}</version> <configuration> <source>${maven.compiler.source}</source> <target>${maven.compiler.target}</target> <annotationProcessorPaths> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </path> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> </path> <path> <groupId>org.hibernate</groupId> <artifactId>hibernate-jpamodelgen</artifactId> </path> </annotationProcessorPaths> </configuration> </plugin> 请注意,版本缺失,因为我们在 bom 中定义了版本。我希望当我们让微服务项目从这个父项目派生时,maven 会接受这个。 然而这似乎不起作用。我们收到一条错误消息: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project jakarta.common-shared: Resolution of annotationProcessorPath dependencies failed: version can neither be null, empty nor blank -> [Help 1] 这让我觉得很奇怪。为什么我必须重新定义 MapStruct、Lombok 或 Hibernate modelgen 的版本?对依赖项进行集中版本控制不是物料清单的本质吗? annotationProcessorPaths 将从 dependencyManagement 开始解析版本 3.12.0 MCOMPILER-391

回答 1 投票 0

在 Mac 上如何更改 Maven 的 Java 版本

在我的mac上我安装了2个java版本,在使用Java -version命令检查时我得到17版本,但是当我检查mvn -version时它显示java版本为22。我想要java版本17...

回答 1 投票 0

Openapi操作ID重复

我正在使用 Open-API 使用 yaml 文件生成 java 类。当我跑步时 mvn 干净安装 我收到此错误: Open-API 生成中出现意外错误 org.openapitools.codegen.SpecValidationExc...

回答 4 投票 0

Github Actions 测试运行显示 0 个测试,本地运行所有测试均运行正常

我已经设置了一个存储库,用于使用 TestNG 和 Maven 构建/运行 selenium 测试。在我的机器上本地运行测试,测试运行没有任何问题,但是在设置 Github acti 之后...

回答 1 投票 0

java.lang.NullPointerException:无法调用“java.sql.ResultSet.next()”,因为Liquibase maven liquibase中的“schemas”为空:diff

我尝试在 Hibernate 实体和 mysql 数据库上使用 mvn liquibase:diff 。构建因奇怪的异常而失败:无法调用“java.sql.ResultSet.next()”,因为“schemas”为空...

回答 1 投票 0

java.lang.ClassNotFoundException:javax.ws.rs.ProcessingException

我正在编写一个 Apache Camel Spring Boot 应用程序来消费和生成 AMQP/JMS 代理。我可以通过 IntelliJ 成功运行应用程序,但是当我尝试通过通信运行应用程序时...

回答 2 投票 0

如何利用 Java 11 中的 cxf-xjc-plugin 生成的类?

使用 Apache cxf-xjc-plugin 和 Java 11 工作正常,我能够从 xsd 文件生成 Java 源。当尝试将这些 Java 类与 JAXB 一起使用时,问题就出现了:可用...

回答 2 投票 0

开放遥测 - 使用 OpenTelemetrySdk 将应用程序日志推送到 OTEL 收集器

我正在尝试通过以下方式将数据推送到OTEL收集器。 @配置 公共类 OpenTelemetryLogConfiguration { @豆 公共 OpenTelemetrySdk 初始化 OpenTelemetryConfi...

回答 1 投票 0

Maven Google Sheets 版本问题

我有一个Java Maven项目,需要google-api-client版本2.0.0+(当前使用2.4.0): com.google.api-client 走...

回答 1 投票 0

spring boot maven插件停止目标

Spring boot maven 插件停止目标无法停止应用程序并使应用程序进程挂起(并且我无法使用同一端口启动另一个进程)。 这是插件配置...

回答 3 投票 0

从测试中读取隐藏的 src/main/properties 数据文件

标准Maven项目配置,其中资源实际位于src/main/resources/中,缩写的测试数据保存在src/test/resources中。 我正在尝试添加一个想要验证的测试...

回答 1 投票 0

在线Cucumber报告和控制台输出在同一行

这是一个selenium java项目,使用Intellij Idea来运行测试自动化场景。它最后生成在线黄瓜报告。但正如你在图片中看到的,不幸的是,它梳理了......

回答 1 投票 0

从 jenkins 管道获取 Maven Spring 配置文件

我在使用 Spring 配置文件的 Maven Spring Boot 项目上遇到詹金斯管道问题。 这是 pom.xml: 开发 <

回答 1 投票 0

从 Eclipse 切换到 Visual Studio Code

我想从 Eclipse 切换到 Visual Studio Code 并开始使用 Microsoft GitHub Copilot。 我正在寻找与maven相关的设置来指定settings.xml文件,因为在m...

回答 1 投票 0

未找到Maven依赖模块

我在 Maven 中有一个相当简单的项目结构,带有子模块: / -pom.xml -实用程序/ -pom.xml 在 /pom.xml 中,我定义了所有子模块的属性,例如库版本或插件配置...

回答 3 投票 0

Maven/Java 文件存储

我正在使用 Maven 开发一个项目,我有点困惑在这个程序中存储文件以供访问的正确方法是什么? 我看过使用 Maven 资源,但我不是超级

回答 1 投票 0

Maven 将 Target 中生成的 JAR 复制到外部文件夹

在常规 Netbeans 项目中,您有一个 build.xml,我可以使用以下命令将生成的 JAR 文件复制到不同的文件夹: 在常规 Netbeans 项目中,您有一个 build.xml,我可以使用以下命令将生成的 JAR 文件复制到不同的文件夹: <target name ="-post-jar" > <copy file ="${dist.jar}" todir ="../Plugin Jars" failonerror ="true"/> <copy file ="${dist.jar}" todir ="/Users/dev/Desktop/plugins" failonerror ="true"/> </target> 现在我有一个使用 Maven 的项目,但我找不到完成相同任务的方法。 编辑:感谢我们的贡献者,我能够通过以下条目来做到这一点 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <id>copy-installed</id> <phase>install</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>${project.groupId}</groupId> <artifactId>${project.artifactId}</artifactId> <version>${project.version}</version> <type>${project.packaging}</type> </artifactItem> </artifactItems> <outputDirectory>/Users/dev/Desktop/plugins</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> 使用maven-dependency-plugin 以下文档有一个示例,其中他们将刚刚构建的工件复制到自定义位置。 https://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html(在页面中搜索“依赖项:复制目标也可用于将刚刚构建的工件复制到如果需要,可以自定义位置”) @Deadron 答案是正确的。我只是在这里复制正确的代码片段(有一些小的改进)以供更好的参考。 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.6.1</version> <executions> <execution> <id>copy</id> <phase>package</phase> <goals> <goal>copy</goal> </goals> </execution> </executions> <configuration> <artifactItems> <artifactItem> <groupId>${project.groupId}</groupId> <artifactId>${project.artifactId}</artifactId> <version>${project.version}</version> <type>${project.packaging}</type> <overWrite>true</overWrite> <outputDirectory>/my/install/path</outputDirectory> <destFileName>MyDestJar.jar</destFileName> </artifactItem> </artifactItems> </configuration> </plugin>

回答 2 投票 0

如何创建Maven库(非可执行JAR)

我正在寻找一个 Git 存储库,我可以克隆它并开始为 Java/Maven 创建一个简单的库。我假设我需要声明一个 mainClass 它将作为库的接口,但我不知道...

回答 2 投票 0

以maven可发布兼容的方式构建gradle插件+共享代码+库(目前子项目是一个问题)

我想结合以下内容: 可以访问共享 kotlin 库的 gradle 插件 共享的 kotlin 库 可以访问 gradle 插件以及共享 kotlin 库的库 基地

回答 1 投票 0

我尝试在 Amazon Linux 实例上安装 Jenkins 并收到如下错误

我尝试在 Amazon Linux 实例上安装 Jenkins 并收到错误: jenkins.service 的作业失败,因为控制进程退出并显示错误代码。 请参阅“systemctl status jenkins.servi...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.