1

現在、maven を使用して Alfresco を構築しています。私のメインの pom にはいくつかのサブ pom があり、それぞれが今のところ SNAPSHOT-1.0 です。

コマンド ラインから mvn install を実行すると、/target/.war に war ファイルが作成されますが、Jenkins でビルドすると、-SNAPSHOT-1.0.war という名前のアーティファクトが作成されます。ワークスペースでは、それらはまだ .war ですが、Jenkins は何らかの理由で Maven バージョンを追加してアーティファクトを作成します。

これらの war をアプリケーション サーバーに展開する場合 (現在は ssh 展開に限定されています)、最初にそれらの名前を変更して、適切なコンテキスト ルートで展開されるようにする必要があります。

バージョン番号のない通常の名前としてアーティファクトを他のビルドジョブで利用できるようにする方法はありますか? 現在、アーティファクトをコピーして展開前に名前を変更する仕事がありますが、もっとクリーンな方法が必要だと考えていました。

更新: メイン pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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>nz.net.example</groupId>
<artifactId>dept-alfresco</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Quickstart of Alfresco and Share with DB and runner embedded</name>
<description>This All-in-One project allows to manage all the components involved in Alfresco development (Repo, Share, Solr, AMPs) in one project</description>
<packaging>pom</packaging>    

<parent>
    <groupId>org.alfresco.maven</groupId>
    <artifactId>alfresco-sdk-parent</artifactId>
    <version>1.0</version>
</parent>

<!-- 
   | SDK properties have sensible defaults in the SDK parent,
   | but you can override the properties below to use another version. 
   | For more available properties see the alfresco-sdk-parent POM. 
   -->
<properties>
    <alfresco.groupId>org.alfresco</alfresco.groupId>
    <alfresco.version>4.2.c</alfresco.version>
    <app.log.root.level>WARN</app.log.root.level>
    <alfresco.data.location>alf_data_dev</alfresco.data.location>
    <alfresco.port>8080</alfresco.port> 
    <share.port>8080</share.port>
    <!-- This controls which properties will be picked in src/test/properties for embedded run -->
    <env>local</env>

    <!-- Build Information to be injected during Jenkins build process -->
    <build.date>Not Built with Jenkins</build.date>
    <jenkins.buildNo>Not Built with Jenkins</jenkins.buildNo>
    <jenkins.buildURL>Not Built with Jenkins</jenkins.buildURL>
    <jenkins.job>Not Built with Jenkins</jenkins.job>
    <git.branch>Not Built with Jenkins</git.branch>
    <git.commit>Not Built with Jenkins</git.commit>
</properties>

<!-- Here we realize the connection with the Alfresco selected platform (e.g.version and edition) -->
<dependencyManagement>
 <dependencies>
      <!-- This will import the dependencyManagement for all artifacts in the selected Alfresco plaftorm
           (see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
           NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement.
           NOTE: It defaults to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom   
       -->
      <dependency>
          <groupId>${alfresco.groupId}</groupId>
          <artifactId>alfresco-platform-distribution</artifactId>
          <version>${alfresco.version}</version>
          <type>pom</type>
          <scope>import</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>
</dependencyManagement>

<!--
No more repos are needed since they will be inherited by the parent POM. 
This is needed to download the alfresco-plaftorm POM.
-->
<repositories>
    <repository>
        <id>alfresco-artifacts</id>
        <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
    </repository>
    <repository>
        <id>alfresco-artifacts-snapshots</id>
        <url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url>
    </repository>
</repositories>
  <modules>
<module>amp</module>
<module>alfresco</module>
<module>solr</module>
<module>share</module>
<module>wcmqs</module>
<module>runner</module>
</modules>
</project>

そして、ここにサブポンがあります

<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
license agreements. See the NOTICE file distributed with this work for additional 
information regarding copyright ownership. The ASF licenses this file to 
You under the Apache License, Version 2.0 (the "License"); you may not use 
this file except in compliance with the License. You may obtain a copy of 
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
by applicable law or agreed to in writing, software distributed under the 
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
OF ANY KIND, either express or implied. See the License for the specific 
language governing permissions and limitations under the License. -->
<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>
<artifactId>alfresco</artifactId>
<name>Alfresco Repository and Explorer Client</name>
<packaging>war</packaging>
<description>Alfresco Repository and Explorer Client</description>
<parent>
    <groupId>nz.net.example</groupId>
    <artifactId>dept-alfresco</artifactId>
    <version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
    <dependency>
        <groupId>${alfresco.groupId}</groupId>
        <artifactId>alfresco</artifactId>
        <type>war</type>
    </dependency>
     <!--
     <dependency> 
        <groupId>${alfresco.groupId}</groupId>
        <artifactId>alfresco-repository</artifactId>
    </dependency>
     -->
</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                <!--  Here is can control the order of overlay of your (WAR, AMP, etc.) dependencies
                    | NOTE: At least one WAR dependency must be uncompressed first
                    | NOTE: In order to have a dependency effectively added to the WAR you need to 
                    | explicitly mention it in the overlay section.
                    | NOTE: First-win resource strategy is used by the WAR plugin
                     -->
                <overlays>
                    <!-- Current project customizations -->
                    <overlay />
                    <!-- The Alfresco WAR -->
                    <overlay>
                        <groupId>${alfresco.groupId}</groupId>
                        <artifactId>alfresco</artifactId>
                        <type>war</type>
                        <!-- To allow inclusion of META-INF -->
                        <excludes />
                    </overlay>
                </overlays>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>
4

1 に答える 1