2014-10-10 12 views
1

我確定我的插件中沒有maven-source-plugin,但是在發佈時會執行[project-name] -sources.jar:perform。在構建生命週期的其他階段,似乎沒有這樣做。在Maven發佈期間製作* sources.jar的是什麼?

不幸的是,這個[project-name] -sources.jar被上傳到我們的倉庫(Nexus)。管理層希望所有的數據源都保存在SVN中,並且遠離存儲庫。

我該怎麼做?這當然不是裝配問題。我們嘗試了不同的構建配置文件,但[project-name] -sources.jar仍然存在。我們只是不希望在發佈期間將任何源代碼上傳到存儲庫。

任何想法任何一個?

在此先感謝。

下面就是我們在標籤中使用:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.5.1</version> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
       <compilerArgument>-Xlint:all</compilerArgument> 
       <showWarnings>true</showWarnings> 
       <showDeprecation>true</showDeprecation> 
      </configuration> 
     </plugin> 

     <!-- Release Reference: http://maven.apache.org/maven-release/maven-release-plugin/index.html --> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-release-plugin</artifactId> 
      <version>2.4.2</version> 
      <configuration> 
       <tagBase>http://some.url.here</tagBase> 
       <checkModificationExcludes> 
        <checkModificationExclude>.classpath</checkModificationExclude> 
        <checkModificationExclude>.factorypath</checkModificationExclude> 
        <checkModificationExclude>.project</checkModificationExclude> 
        <checkModificationExclude>.rest-shell.log</checkModificationExclude> 
        <checkModificationExclude>.springBeans</checkModificationExclude> 
        <checkModificationExclude>.apt-generated/**</checkModificationExclude> 
        <checkModificationExclude>.settings/**</checkModificationExclude> 
        <checkModificationExclude>src\main\resources\rebel.xml</checkModificationExclude> 
       </checkModificationExcludes> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-javadoc-plugin</artifactId> 
      <version>2.2</version> 
      <configuration> 
       <skip>true</skip> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.1.1</version> 
      <configuration> 
       <archive> 
        <index>true</index> 
        <manifest> 
         <addClasspath>true</addClasspath> 
        </manifest> 
        <manifestEntries> 
         <version>${project.version}</version> 
        </manifestEntries> 
       </archive> 
      </configuration> 
     </plugin> 

    </plugins> 
</build> 
+0

順便說一句:你使用的是非常舊版本的插件。 – khmarbaise 2014-10-10 20:10:11

回答

2

所以這裏的答案是我自己的問題的情況下,有人想知道周圍的工作:

<plugins> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-release-plugin</artifactId> 
    <configuration> 
     ... 
     <useReleaseProfile>false</useReleaseProfile> 
     ... 
    </configuration> 
    </plugin> 
</plugins> 
2

的簡單的答案是,釋放過程中運行maven-sources-plugin連接到構建生命cylce(包階段),這是由物業performRelease激活。這是在super-pom which defines this are a profile.

這裏定義爲超級POM的適當部分:

<profiles> 
    <!-- NOTE: The release profile will be removed from future versions of the super POM --> 
    <profile> 
     <id>release-profile</id> 

     <activation> 
     <property> 
      <name>performRelease</name> 
      <value>true</value> 
     </property> 
     </activation> 

     <build> 
     <plugins> 
      <plugin> 
      <inherited>true</inherited> 
      <artifactId>maven-source-plugin</artifactId> 
      <executions> 
       <execution> 
       <id>attach-sources</id> 
       <goals> 
        <goal>jar</goal> 
       </goals> 
       </execution> 
      </executions> 
      </plugin> 
      <plugin> 
      <inherited>true</inherited> 
      <artifactId>maven-javadoc-plugin</artifactId> 
      <executions> 
       <execution> 
       <id>attach-javadocs</id> 
       <goals> 
        <goal>jar</goal> 
       </goals> 
       </execution> 
      </executions> 
      </plugin> 
      <plugin> 
      <inherited>true</inherited> 
      <artifactId>maven-deploy-plugin</artifactId> 
      <configuration> 
       <updateReleaseInfo>true</updateReleaseInfo> 
      </configuration> 
      </plugin> 
     </plugins> 
     </build> 
    </profile> 
    </profiles> 
+0

這正是根源,Maven發佈插件文檔中明確指出「useReleaseProfile」默認爲true;因此,如果不關閉它,它將使用超級POM的maven-source-plugin。我非常感謝你的回答。謝謝@khmarbaise – hb5fa 2014-10-11 22:49:50

相關問題