有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

pom中指定的java maven插件。xml不会执行

我正在构建我的Java项目,并指定了2个maven插件,maven jar插件和maven依赖插件。我从命令行执行mvn clean package。源代码编译成功;然而,我从未看到依赖插件执行。此外,在执行mvn--debug clean包时,我没有看到jar插件使用我指定的参数执行

我正在寻找一些帮助,来解释为什么在执行mvn clean package时这些插件没有运行

pom的一个片段。xml:

仅供参考,我没有包括所有依赖项和groupId,主要类信息已更改以保护无辜者。然而,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>com.mygroupId</groupId>
  <artifactId>ssmgr</artifactId>
  <version>0.1</version>

  <name>ssmgr</name>


  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <mainClass>com.myclass.App</mainClass>
    <dependenciesDirectory>libs</dependenciesDirectory>
  </properties>

  <build>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.1.1</version>
          <executions>
            <execution>
              <id>copy-dependencies</id>
              <phase>package</phase>
              <goals>
                <goal>copy-dependencies</goal>
              </goals>
              <configuration>
                <outputDirectory>${project.build.directory}/${dependenciesDirectory}</outputDirectory>
                <overWriteReleases>false</overWriteReleases>
                <overWriteSnapshots>false</overWriteSnapshots>
                <overWriteIfNewer>true</overWriteIfNewer>
                <!-- <overWriteIfNewer>true</overWriteIfNewer> -->
                <!--<includeScope>runtime</includeScope>
                <excludeScope>test</excludeScope>
                <useBaseVersion>false</useBaseVersion> -->
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.2.0</version>
          <executions>
            <execution>
              <id>create-jar</id>
              <configuration>
                <archive>
                  <manifest>
                    <addClasspath>true</addClasspath>
                    <classpathPrefix>${dependenciesDirectory}</classpathPrefix>
                    <mainClass>com.myclass.App</mainClass>
                  </manifest>
                </archive>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <dependencies>
    <dependency>
    </dependency>
  </dependencies>
</project>

共 (0) 个答案