2010-10-05 52 views
4

Google让我失败了,即使在这里我也找不到答案 - 让我在这里发布我的第一个问题。Maven校验和pom设置?

我试图让命令“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> 

我相信答案是简单的东西,但我不明白我在做什么错。任何人都想回答这个垒球?

回答

8

该Maven Install Plugin的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上安装插件页面。感谢答案!!! – ogradyjd 2010-10-06 11:06:16

+1

@ogradyjd:不客气。顺便说一下,POM配置只是从mojo的文档中衍生出来的(如果一个目标允许一个参数'foo',你可以在一个''元素中用' bar'来配置它。虽然用户页面是受欢迎的。 – 2010-10-06 21:00:34