maven-2 - Maven 校验和 pom 设置?

标签 maven-2 checksum pom.xml

谷歌让我失望了,即使在这里我也找不到答案 - 让我真正在这里发布我的第一个问题。

我正在尝试使用命令“mvn install”来自动生成工件的校验和,并将校验和与工件一起放置在存储库中。我读到的所有内容似乎都表明它应该在没有我干预的情况下发生,但我得到的只是工件、源 zip、pom 和本地元数据 xml。

该项目的 pom 如下所示:

<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>my.pkg.name</groupId>
  <artifactId>Logging</artifactId>
  <version>1.2.0-SNAPSHOT</version>
  <build>
    <sourceDirectory>src/java</sourceDirectory>
    <testSourceDirectory>test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>src/conf</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>test/conf</directory>
      </testResource>
    </testResources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0.2</version>
            <configuration>
              <source>1.5</source>
              <target>1.5</target>
              <debug>true</debug>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>2.3</version>
        </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.4</version>
            <configuration>
              <configLocation>checkstyle.xml</configLocation>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring</artifactId>
      <version>2.5.6.SEC02</version>
    </dependency>
    <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>3.8.2</version>
     <type>jar</type>
     <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

我确信答案很简单,但我不知道我做错了什么。有人想回答这个垒球吗?

最佳答案

install:install Maven 安装插件的目标有一个可选的 createChecksum默认为 false 的参数。

在命令行上将其设置为 true(如 Creating Checksums 中所述):

mvn install -DcreateChecksum=true

或者在插件配置中:

<plugin>
  <artifactId>maven-install-plugin</artifactId>
  <version>2.3.1</version>
  <configuration>
    <createChecksum>true</createChecksum>
  </configuration>
</plugin>

关于maven-2 - Maven 校验和 pom 设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3865343/

相关文章:

java - Jersey 和 JAX-RS

go - 为什么我的滚动 adler32 校验和在 go 中不起作用? (模算术)

java - 跨不相关项目共享 Maven pom.xml 部分的最佳方式?

maven - 如何使用 maven pom.xml 创建 jar

maven-2 - 我该如何解决这些Maven 2警告?

maven-2 - aar 文件未添加到 war axis2-aar-maven-plugin 中

c - Fletcher 16 校验和适合小数据吗?

java - 我是否必须手动列出 Java POM 中 <resources> 内的所有子目录

maven-2 - 马文 : local development deploy vs bundling for distribution

C - 读取二进制文件,验证校验和