项目对象模型或POM是Maven的基本工作单元。
我有一个包含多个模块的项目,当我全局编译该项目时它可以工作,但是当我尝试编译某些模块时,它给了我这个错误: 错误:无法找到或加载主类% 因...
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>
IntelliJ IDEA 2024.1 中 Maven 工具窗口消失了
Maven 工具窗口已从我的 Maven 驱动项目中消失,但仍存在 pom.xml 文件。 我正在使用 IntelliJ IDEA 2024.1(终极版)。 这是一个屏幕截图,显示: 没有可用的 Maven 工具...
我想添加java项目的lib文件夹中的所有jar。在gradle中,它是通过以下代码完成的: 实现 fileTree(dir: 'lib', include: '*.jar') 如何使用
Mooc.fi 第 13 部分 图形用户界面 - 如何让 JavaFX 工作
我还没有设法让 JavaFX 工作,因此我陷入了第 13 部分图形用户界面我的第一个应用程序(https://java-programming.mooc.fi/part-13/1-graphical-user-interfaces) 。 我有...
使用 Azure 部署应用程序时,“未知生命周期阶段“mvn”。您必须指定有效的生命周期阶段或目标”
我正在尝试使用 Azure Devops 在云中心部署 Mule 应用程序。 在尝试部署应用程序时,我正在运行一个作业,其中有一个 Maven 任务,该任务假设运行 Maven 命令: ...
将应用程序升级到 Java 21 和 Maven PMD 插件不兼容
我在将应用程序升级到 Java 21 时遇到问题。现有的 Maven PMD 插件(版本 3.19.0)似乎与 Java 21 不兼容。 以下是问题的详细分析: 升级要求...
我正在使用 HtlmUnit,当查询网页时,我在线程“AWT-EventQueue-0”java.lang.NoSuchFieldError: INSTANCE”中遇到异常
我无法使用从 sourgeforce 安装的 htmlUnit 库读取网页内容。我需要帮助来解决问题,因为我尝试重新安装库...
我想即时修改 pom.xml 文件,以使 Maven 针对特定的 groupId 使用本地安装的 JAR。所以,我需要: 更改/设置每个匹配系统依赖项的范围。 添加
我有 2 个 testng.xml 文件,名为 testng_smoke.xml 和 testng_regression.xml。我已如下配置 pom.xml 来运行这些 testng 文件。 org.ap...
我执行 maven update pom 后类就崩溃了[关闭]
我的类以前运行良好,更新 Maven 不是问题。但是现在,如果我更新 Maven 项目中不同包中的所有类,则无法相互识别。我
src/main/resources 文件被 src/test/resources 覆盖
我使用spring-boot实现了一个Web服务。它在初始化期间从文件中读取。所以我将文件创建为 src/main/resources/files/init_file.txt。这是一个巨大的文件,需要一些时间...
在使用 deps.edn 的 Clojure 项目中,在哪里跟踪包名称和版本?
使用 deps.edn 在 Clojure 项目中的何处跟踪/存储包名称和版本字符串?例如,在 Rust 项目中,有一个 Cargo.toml 文件,其中包含包名称和
无法在服务中启动spring cloud eureka客户端
无法在服务中启动spring cloud eureka客户端。 我正在使用最新的 spring 2.1.1 版本。 Discovery Server 以正确的方式启动,但服务客户端却不然。 无法追踪什么
Maven 配置,以便如果代码中出现 System.out.println 则构建失败
我们想从项目中删除所有system.out.println。 如何配置 pom 或者需要哪些依赖项。 谢谢, 阿尼尔
不允许使用 jakarta.xml.ws.spi.Provider 密钥访问系统属性
我在执行Maven clean install时发现了这个错误。我以前从未见过它,并且在网上找不到任何有关它的参考资料。尝试更改依赖项版本没有帮助。 11 月 21 日,...
无法在 https://github.com/geosolutions-it/geoserver-manager 的 Maven 项目中包含 lib 及其依赖项
我正在尝试将这个 git hub 存储库包含在我的 Maven 项目中。我已根据自述文件将以下内容添加到我的 pom.xml 中。 地理解决方案 我正在尝试将此 git hub 存储库包含在我的 Maven 项目中。我已根据自述文件将以下内容添加到我的 pom.xml 中。 <repository> <id>GeoSolutions</id> <url>http://maven.geo-solutions.it/</url> </repository> <dependency> <groupId>it.geosolutions</groupId> <artifactId>geoserver-manager</artifactId> <version>1.7.0</version> </dependency> 但是,在进行全新安装时,我收到此错误 无法解析项目的依赖项无法在 it.geosolutions:geoserver-manager:jar:1.7.0 处收集依赖项:无法读取 it.geosolutions:geoserver-manager:jar:1.7.0 的工件描述符:以下工件可能未解决: it.geosolutions:geoserver-manager:pom:1.7.0 (缺席):无法从/到 maven-default-http-blocker 传输工件 it.geosolutions:geoserver-manager:pom:1.7.0 ( http://0.0.0.0/):存储库被阻止的镜像:[GeoSolutions(http://maven.geo-solutions.it/,默认,releases+snapshots)] 我希望能够在我的项目中使用它 您可以将其添加到您的setting.xml中: <mirror> <id>GeoSolutions</id> <url>http://maven.geo-solutions.it</url> <mirrorOf>*</mirrorOf> </mirror> 我也遇到了同样的问题,我刚刚解决了。你可以尝试一下这个方法是否适合你。
Maven 上传 zip 和 pom 到 Artifactory 失败
我在 Artifactory 中有 Maven 存储库。 我想使用maven部署命令上传pom文件和zip文件(来自源代码的包)。我不想使用卷曲来做到这一点(它的工作原理是...
无法包含项目工件:com.test.mmm.jar:1.0;它没有关联的文件或目录
我对 Maven 很迷茫,我似乎找不到解决我的问题的方法。当我尝试生成包含项目所有依赖项的 jar 文件以在另一台计算机上执行它时,我发现...
Selenium:selenium-manager.exe 被阻止
我正在 Eclipse 中设置一个新的 Selenium maven 项目,并使用 selenium 版本 4.18.1 在 pom.xml 文件中 org.seleniumhq.selenium <