maven-3 相关问题

Apache Maven是一个用于项目管理和构建自动化的工具。此标记用于与Maven版本3.x相关的问题。对于非特定版本的问题,请使用[maven]标记。

项目本地文件夹中的第三方依赖库

我的项目需要使用一些第三方依赖库,它们不在maven存储库中。我将它们放入项目文件夹中名为 3rd_deps 的文件夹中,在 pom.xml 中,我有以下内容...

回答 1 投票 0

如何在 Maven 中配置编码?

当我在多模块 Maven 项目上运行 Maven 安装时,我总是得到以下输出: [警告] 文件编码尚未设置,使用平台编码 UTF-8,即构建取决于平台...

回答 7 投票 0

如何设置maven 3.8包装器mvnw.cmd的工作目录?

适用范围:Windows 如何设置maven 3.8包装器mvnw.cmd的工作目录?

回答 1 投票 0

无法关闭 selenium webdriver 对象 4.11.0 和 4.12.1

每当我尝试关闭网络驱动程序时,它都会抛出错误:“java.net.SocketException:连接重置”。 代码片段、控制台日志和 pom.xml 可在以下位置找到...

回答 1 投票 0

将构建从 Linux 移植到 Windows 的 Maven 问题

我正在将项目构建从 Linux 移植到 Windows。我的 pom.xml 的以下部分遇到问题 我更换了 rm -rf 节点模块/ ...

回答 1 投票 0

错误:不可解析的父POM:无法传输工件org.springframework.boot:spring-boot-starter-parent:pom

尝试运行我的应用程序时,我在 pom.xml 中遇到以下异常。我看到了一些关于该错误的帖子并关注了它们,但没有用。我了解工件(父级)被引用为...

回答 4 投票 0

Pom.xml项目构建错误

我已在 Eclipse 中导入了 Maven 项目,但在 pom.xml 中出现以下错误- 项目构建错误: 'dependencyManagement.dependency.dependency.systemPath' 为 jdk.工具:jdk.

回答 4 投票 0

如何在命令行上指定 Maven 依赖插件 get 的版本范围

我正在尝试使用 Maven 依赖插件来获取特定版本范围内的工件。我需要在命令行(或在脚本中)执行此操作 这是我尝试过的: mvn 依赖项:get -Dart...

回答 3 投票 0

maven 3.1.0编译不使用代理用户名

在 Windows XP 上运行,我设置 ~/.m2/settings.xml 以包含以下代理设置: 可选 真实 h...

回答 2 投票 0

更新maven中的所有版本

我有一个maven项目,其中有大量具有许多依赖项的子项目。现在我想将我的 pom 文件的所有版本更新到新版本并重建它们。例如,如果我有一个...

回答 2 投票 0

Maven:Maven 属性值概述

我想找出所有 Maven 属性的值,因为它们适用于某些 Maven 项目。 mvn help:system 列出操作系统环境变量和 JVM 系统属性,但没有 Maven 属性。 MVN

回答 7 投票 0

maven-shade-plugin 重新定位多版本 jar 中 META-INF/版本下的类

我正在使用阴影来创建超级罐子。我重新定位了依赖类以避免冲突。但是,我找不到有关如何在 META-INF/versions 下重新定位类的在线文档。

回答 3 投票 0

无法启动jboss.deployment.unit。“war”.POST_MODULE

我按照本教程使用 NetBeans 中数据库的 RESTful Web 服务创建了一个 Maven 项目: http://jaxenter.com/from-database-to-restful-web-service-to-html5-in-10-minutes-105524...

回答 1 投票 0

Maven 仅在默认包中生成 Antlr 源

我将从我的 pom.xml 开始: 我将从我的 pom.xml 开始: <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>HPK</groupId> <artifactId>WRB</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>WRB</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.antlr</groupId> <artifactId>antlr4</artifactId> <version>4.5.3</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>auto-clean</id> <phase>initialize</phase> <goals> <goal>clean</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.antlr</groupId> <artifactId>antlr4-maven-plugin</artifactId> <version>4.3</version> <executions> <execution> <configuration> <arguments> <argument>-visitor</argument> <argument>-package</argument> <argument>wrb.grammar</argument> </arguments> </configuration> <id>antlr</id> <goals> <goal>antlr4</goal> </goals> </execution> </executions> </plugin> </plugins> <pluginManagement> <plugins> <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. --> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-clean-plugin </artifactId> <versionRange> [3.0.0,) </versionRange> <goals> <goal>clean</goal> </goals> </pluginExecutionFilter> <action> <ignore></ignore> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement> </build> 当我在这个项目上运行 maven install 时,maven 应该从 wrb.grammar 包中的 antlr4 插件生成源代码,但事实并非如此。它做了所有事情,但是将源代码放入这些目录中,它只是将它们放入所谓的“默认包”中,这只是 antlr/generated-sources 的根。 如果我通过右键单击语法并在运行方式下选择它来使用 Antlr4IDE 插件,则会在正确的目录中生成源代码。 与我一起参与这个小项目的另一个人使用 maven-install 没有任何问题。除了我们的操作系统和eclipse版本之外,一切都是一样的。 我在 MacOS 上使用 Eclipse Oxygen。 我做错了什么,maven-plugin 没有生成我想要的目录? 我检查了antlr4 4.3版本的来源。 -package参数仅由代码生成器模板使用,但不在实际工具源代码中的任何位置使用(请参阅genPackage的Github搜索结果)。所以它不会影响输出文件的位置。 相反,每个输出文件的位置是根据相应输入文件的位置确定的(请参阅源中的here和here)。这符合 maven 插件文档中的解释: 如果您的语法打算成为名为 org.foo.bar 的包的一部分,那么您可以将其放置在目录 src/main/antlr4/org/foo/bar 中。然后,该插件将在输出目录 target/ generated-sources/antlr4/org/foo/bar 中生成 .java 和 .tokens 文件。编译 Java 文件时,它们将位于 Javac 编译器的正确位置,无需任何特殊配置。生成的java文件由插件自动提交编译。 此外,使用 antlr4-maven-plugin 时,无需指定 -package 选项。由于插件从输入文件路径中派生出 -package 参数的值,并自动将其添加到 antlr 调用中(请参阅此处的源代码)。这可能也是为什么 -pacakge 不能直接用作 Maven 插件中的 配置参数 的原因。 解决方案 为了将生成的文件放置在与包名称匹配的目录结构中,您需要对输入文件使用相同的结构。 本质上,您需要做的就是将语法文件放入 src/main/antlr4/wrb/grammar 中,从配置中删除 -package 参数,一切都会按预期工作。 顺便说一句:代替写作 <arguments> <argument>-visitor</argument> </arguments> 你可以简单地写 <visitor>true</visitor> 因为这个参数可以被antlr4-maven-plugin直接理解。 正如 @ChristophBöhme 在问题评论中所写,您必须将语法文件放置在与您希望生成的源代码显示完全相同的包中。它实际上与您的 pom.xml 文件无关。 ANTLR 尝试通过查看文件夹树来找出包名称,因此,如果您有一个名为 com 的文件夹,其中包含一个名为 example 的文件夹,其中又包含一个名为 hello_world 的文件夹,那么这将形成包 com.example.hello_world 它将在输出文件夹中生成完全相同的文件夹结构和包。 因此,如果你的包名为 com.example.hello_world,那么你的目录结构必须如下所示,假设你的语法文件位于 src/main/antlr4: hello_world (root project folder) | --src | -- main | -- antlr4 (up to here, these are "verbatim" folders) | -- com.example.hello_world (this is a package, to create it you can make a "source folder" in Eclipse) | -- YourGrammar.g4 | -- target (autogenerated) | -- generated_sources | -- antlr4 | -- com.example.hello_world | -- ...All ANTLR-generated files...

回答 2 投票 0

在多模块maven项目中构建特定模块+有条件地依赖

这个问题是定义模块列表的扩展,应该在Maven多项目构建中构建。 运行 mvn install -pl“project1、project2 等”时-am -Pmy-profile,maven 会

回答 1 投票 0

Mvn:打包 Spring Boot - 不包括 starter-* jar

maven package 命令在生成的 jar 中不包含 spring-boot-stater-*.jar 新鲜的 Spring 启动项目 - Spring Initializr 下载我与任何 starter-* 依赖项一起使用的项目, mvn 清洁 p...

回答 1 投票 0

无法构建maven mule应用程序

当我通过 gitlab 部署时出现此错误 [错误] 无法在项目 project-1.0.0 上执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.10.0:compile (default-compile):编译失败:

回答 1 投票 0

maven 的“.wagon.http.ssl...”命令是否已弃用?

为了禁用我的maven项目的SSL证书有效性检查,我尝试了以下命令: mvn clean install -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.

回答 2 投票 0

为什么Maven每次都下载maven-metadata.xml?

下面是当我尝试使用 Maven 构建 Web 应用程序时,当我的互联网连接不稳定时,我通常会遇到的错误。 我的问题是,为什么maven每次都要下载...

回答 7 投票 0

无法打开 Hibernate 会话进行事务;嵌套异常是 org.hibernate.exception.JDBCConnectionException:无法打开连接

我是 Spring-MVC 和 Hibernate 的新手。尝试使用 Spring-MVC(4.0.3) 、 Hibernate(4.3.5) 并使用 MySQL 作为后端创建一个测试 Web 应用程序。 连接数据库没有问题,因为我...

回答 4 投票 0

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