Maven校验和POM设置?

5
谷歌让我失望了,即使在SO上也找不到答案-这迫使我在这里发布我的第一个问题。
我正在尝试让命令“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>

我相信答案很简单,但我无法弄清楚我做错了什么。有人想回答这个简单的问题吗?

1个回答

12

Maven安装插件的install:install目标具有一个可选的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>

1
我曾经在各个地方看到过命令行,但是pom配置行似乎是“需要知道”的东西,因为它甚至没有列在apache.com的install:install插件页面上。感谢您的回答! - ogradyjd
1
@ogradyjd:不用谢。顺便说一下,POM配置只是从mojo的文档中简单派生而来(如果一个目标允许参数foo,则可以在<configuration>元素内使用<foo>bar</foo>进行配置)。当然,欢迎提供使用说明页面。 - Pascal Thivent
7
这个选项已经在3.0.0+版本中被移除了。https://issues.apache.org/jira/browse/MINSTALL-143 - caduceus

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接