0

使用以下命令行:

mvn 版本:解锁快照依赖项:复制依赖项

我在依赖文件夹中获得了所有具有 SNAPSHOT.jar 名称的快照 jar。

为什么将我的项目打包成战争时没有得到相同的行为?我没有得到 mylibs-modules-1.0-SNAPSHOT.jar,而是得到了那些递增的数字。

已编辑

<project>
<modelVersion>4.0.0</modelVersion>

<artifactId>mylibs</artifactId>
<packaging>war</packaging>
<version>3.4</version>

<parent>
    <groupId>parent</groupId>
    <artifactId>mylibs-parent</artifactId>
    <version>3.4</version>
</parent>

<build>
    <finalName>mylibs-war</finalName>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
        </plugin>
    </plugins>
</build>

父 POM 文件

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>parent</groupId>
<artifactId>mylibs</artifactId>
<packaging>pom</packaging>
<version>3.4</version>

<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-tests</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-processor</artifactId>
        <version>1.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-persistence</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-databean</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-localization</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-net</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-lang</artifactId>
        <version>1.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-metadata</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-events</artifactId>
        <version>1.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mylibs</groupId>
        <artifactId>mylibs-logging</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
</dependencies>

4

1 回答 1

0

根据文档,插件目标并非设计为作为生命周期的一部分运行。描述解锁快照目标的属性部分说

仅通过直接调用执行。

mvn versions:unlock-snapshots这意味着它只有在您像以前那样在命令行中键入时才会运行。


刚刚注意到上面关于命令如何运行的评论:

mvn versions:unlock-snapshots package

我怀疑这不起作用,因为unlock-snapshots目标实际上是更改 POM,但是该package阶段正在使用原始的、未修改的 POM 版本运行。也许运行构建-X会显示这一点。

于 2013-10-04T17:03:19.637 回答