maven-2 - 为什么 maven 编译不适用于 "pom"打包类型

标签 maven-2 target maven-assembly-plugin maven-compiler-plugin

我不知道为什么我的 Maven 构建在当前的 pom 设置中没有生成目标/类,在我的情况下,包装类型必须是“pom”,请告知什么是错误的...谢谢!

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.sm.doctor</groupId>
<artifactId>smdoctor</artifactId>
<packaging>pom</packaging>
<version>${SMDOCTOR_VERSION}</version>
<name>sm doctor</name>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
    <plugins>   
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
                <debug>true</debug>
                <debuglevel>source,lines</debuglevel>
                <showDeprecation>true</showDeprecation>
                <archive>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <appendAssemblyId>false</appendAssemblyId>         
                <finalName>smdoctor</finalName> 
                <descriptors>
                    <descriptor>dist.xml</descriptor>
                    <descriptor>zip.xml</descriptor>
                </descriptors>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.7</version>
    <executions>
      <execution>
        <id>attach-artifacts</id>
        <phase>package</phase>
        <goals>
          <goal>attach-artifact</goal>
        </goals>
        <configuration>
          <artifacts>
            <artifact>
              <file>target/smdoctor.zip</file>
              <type>zip</type>
            </artifact>
          </artifacts>
        </configuration>
      </execution>
    </executions>
  </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix>
                        <mainClass>...</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <version>2.3.1</version>
        </plugin>
    </plugins>
</build>
<dependencies>
    ... 
     </dependencies>

最佳答案

通过将包装类型设置为 pom ,您指定不应编译任何内容。也许 pom毕竟这不是这个神器的正确包装类型吗?看起来您的脚本可以正常运行 jar .

关于maven-2 - 为什么 maven 编译不适用于 "pom"打包类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7075285/

相关文章:

android - 如何更改 Android 项目的目标构建?

java - 在 Maven Checkstyle 插件报告中排除类

java - 在 Eclipse PMD 插件中,我可以引用标准规则集文件吗?

maven-2 - 使用 Maven 自动上传 Nexus 中的工件

c++ - 如何从 add_custom_target/command 调用 CMake 函数?

maven - 如何在多模块 Maven 项目中使用 Maven 程序集插件

java - 如何在我的 Java 项目中使用 Maven,为什么?

iphone - 更改了iPhone应用程序目标名称,现在应用程序“运行完成”

java - Maven 程序集描述符属性

java - 如何使用 maven- assembly-plugin 从 dependencySet 中删除 META-INF ?