ams*_*ams 4 java nexus maven-3 maven
我有一些第三方罐子,我想上传到我的nexus maven repo,到目前为止,我已经找到了两种方法.
Run Code Online (Sandbox Code Playgroud)mvn deploy:deploy-file -DgroupId=<group-id> \ -DartifactId=<artifact-id> \ -Dversion=<version> \ -Dpackaging=<type-of-packaging> \ -Dfile=<path-to-file> \ -DrepositoryId=<id-to-map-on-server-section-of-settings.xml> \ -Durl=<url-of-the-repository-to-deploy>
我期待第三方库经常更新,当有安全更新/发布时,可能会更频繁地说四分之一.
上面两种方法都是手动的,你必须输入一个长命令或点击它来实现它.我更喜欢一个不是特定产品或需要冗长命令行选项的简单解决方案.
有没有可能写一个maven pom.xml,只是通过这样做发布第三方.tar.gz mvn deploy
我正在使用maven 3.0.5
更新根据下面的radai答案为我工作的示例pom.xml.
我们在这里有一个类似的需求,保持非maven工件的标签,并在我们的nexus中更新它们.
我们这样做的方法是在版本控制中有一个"第三方"项目,它存储非maven工件,每个工件都有自己的pom文件.
当您升级任何第三方时,您将覆盖第三方项目中的旧第三方,将相关pom文件中的版本打包并运行"mvn deploy"
以将其放入我们的存储库中.
一个pom文件的"构建",导致*.tar.gz将有一个像这样的pom:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>myArtifact</artifactId>
<packaging>pom</packaging> <!-- so it wont auto-create any *.jars or anything -->
<build>
<resources>
<resource>
<!-- put a configuration here to copy your artifact to /target -->
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy static resource files</id>
<goals>
<goal>resources</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
<plugin>
<!-- this creates your *.tar.gz -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>Create final ZIP package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>platform-assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
在它旁边有一个seembly描述符:这个将一堆东西打包为*.tar.gz,保留*.sh文件的可执行标志.您需要编辑以满足您的需求
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>${envClassifier}</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>yourTargetDir</directory>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>**/*.sh</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>yourTargetDir</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*.sh</include>
</includes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
编辑:如果您不需要提取/混乱/ .tar.gz工件,您有一个更简单的选项 - 使用构建帮助器maven插件的附加工件目标只需附加您的*.tar.gz以包含在部署/安装
你显然需要更新依赖于这个新工件版本的所有步伐.
归档时间: |
|
查看次数: |
7828 次 |
最近记录: |