2010-10-05 231 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