首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >maven-deploy-plugin存储库

maven-deploy-plugin存储库
EN

Stack Overflow用户
提问于 2013-03-19 15:58:39
回答 2查看 12.4K关注 0票数 1

我想使用maven- deploy -plugin部署一个文件。目前,我的pom中有以下内容:

代码语言:javascript
复制
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.7</version>
            <executions>
                <execution>
                    <id>deploy-features-xml</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>deploy-file</goal>
                    </goals>
                    <configuration>
                        <repositoryId>${project.distributionManagement.snapshotRepository.id}</repositoryId>
                        <url>${project.distributionManagement.snapshotRepository.url}</url>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>${project.artifactId}</artifactId>
                        <version>${project.version}</version>
                        <file>features.xml</file>
                    </configuration>
                </execution>
            </executions>
        </plugin>

我想根据版本在快照和发布存储库之间进行切换。如果项目版本是1-SNAPSHOT,则应将文件部署到快照存储库;如果项目是版本1.0,则应将文件部署到发布存储库。但是maven-deploy-plugin硬编码吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-03-22 07:31:11

我最终得到的解决方案是使用build-helper-maven-plugin和maven-resources-plugin。这个设置意味着,与jar和pom一起,project将部署一个xml文件,该文件可以在maven存储库中作为project/xml/feature引用。

相关pom插件:

代码语言:javascript
复制
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-artifacts</id>
                    <phase>package</phase>
                    <goals>
                        <goal>attach-artifact</goal>
                    </goals>
                    <configuration>
                        <artifacts>
                            <artifact>
                                <file>target/features/features.xml</file>
                                <type>xml</type>
                                <classifier>features</classifier>
                            </artifact>
                        </artifacts>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-features</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>target/features</outputDirectory>
                        <resources>
                            <resource>
                                <directory>src/main/features</directory>
                                <filtering>true</filtering>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
票数 2
EN

Stack Overflow用户

发布于 2013-03-19 17:37:20

默认情况下已经给出了这个行为。但您应该使用repository manager。您可以通过mvn deploy简单地部署工件,通常具有快照版本的工件将进入快照存储库中,如果是发布版本,则将进入发布存储库。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15494191

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档