java - 如何使用 Maven 包阶段调用 exec-maven-plugin 目标?
问题描述
我已经在我的模块的 pom.xml 文件中配置了 exec-mavein-plugin ,但有些地方不太对劲。
我可以调用目标目录mvn exec:exec
,它可以正常工作并创建一个可执行文件。
我相信它已正确配置为附加到包阶段。但是当调用包阶段时,不会创建输出文件。我希望对配置的一个小调整可以解决它。
这是 pom.xml 文件。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.exache.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>
<parent>
...
</parent>
<artifactId>rmqcm</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>rmqcm</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>Create Executable</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${project.basedir}/scripts/make_rmqcm.bat</executable>
<arguments>
<argument>${project.basedir}\scripts\executable_java_stub.sh</argument>
<argument>${project.build.directory}\${project.build.finalName}.jar</argument>
<argument>${project.build.directory}\${project.name}</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
我感谢您的帮助。
拉斯彼得森
解决方案
推荐阅读
- android-studio - Android Studio 和 Intelij Idea 中不可用的设备
- c# - 如何解决“Package Google Authenticator 1.2.1 已使用 .NETFramework 恢复”,但我不想升级到最新版本(C#)
- c# - 带有 EF Core 5.0 的 ASP Core 3.1 API
- python - 在 Python 3.8 中没有附加类的 TypedDict 的键入键、值
- amazon-web-services - AWS 过滤和导出日志
- python-3.x - 一对多关系sqlite3的问题
- c# - 我的网络应用程序从法语资源中获取翻译,我知道为什么
- scala - 如何使用 AsyncHttpClientCatsBackend 忽略 Scala 上的 SSL 认证?
- appgallery - 当我上传包时,一直出现错误:“上传失败”
- python - Django 无法加载带有静态文件的简单静态页面