我有一个非Java项目,它生成一个版本化的构建工件,我想将它上传到Nexus存储库.因为项目不是Java,所以它不使用Maven进行构建.我宁愿不介绍Maven/POM文件只是为了让文件进入Nexus.
博客上的Nexus REST API链接最终都在登录墙上,没有"创建用户"链接,我可以看到.
那么,在没有Maven的情况下,将构建工件上传到Nexus存储库的最佳(或任何合理)方法是什么?"bash + curl"会很棒,甚至是Python脚本.
我们有一个轻微的错综复杂的情况......
在大多数情况下,我们一直在使用IVY和ANT来管理我们的构建和依赖项.现在该公司正在转向使用Maven.我们有一组称为公共库的项目,这些项目被几个核心产品使用.
公共库使用IVY并发布到IVY存储库.我们还需要为我们的新Maven项目提供公共库.因此,当公共库被构建和发布时,我已经修改了脚本以发布到Maven(Artifactory)以及IVY.以下是发布构建的IVY项目时现在调用的两个目标:
<target name="publish-ivyrepo" depends="load-ivysettings">
<ivy:resolve file="ivy.xml" />
<ivy:publish
module="${ant.project.name}"
artifactspattern="${dist.dir}/[artifact].[ext]"
resolver="integration"
pubrevision="${build.version}"
status="integration"
overwrite="true"
update="true"/>
</target>
<target name="publish-artifactory" depends="load-ivysettings">
<ivy:resolve file="ivy.xml" />
<ivy:publish
module="${ant.project.name}"
artifactspattern="${dist.dir}/[artifact].[ext]"
resolver="artifactory"
pubrevision="${build.version}-SNAPSHOT"
status="integration"
overwrite="true"
update="true"/>
</target>
Run Code Online (Sandbox Code Playgroud)
以下是详细说明解析器的IVY设置:
<sftp name="integration" checkmodified="true" changingPattern=".*" host="host" user="ivy" userPassword="abc">
<ivy pattern="${ivy.integration.default.root}/${ivy.public.default.ivy.pattern}"/>
<artifact pattern="${ivy.integration.default.root}/${ivy.public.default.artifact.pattern}"/>
</sftp>
<url name="artifactory" checkmodified="false" changingPattern=".*" m2compatible="true">
<ivy pattern="http://server/artifactory/libs-snapshot-local/${maven.default.ivy.pattern}"/>
<artifact pattern="http://server/artifactory/libs-snapshot-local/${maven.default.artifact.pattern}"/>
</url>
Run Code Online (Sandbox Code Playgroud)
这种作品我现在在Artifactory中看到了常见的库jar,SNAPSHOT代替了唯一的时间戳.但是,源jar和IVY xml文件没有替换SNAPSHOT.此外,没有生成POM文件(虽然我不知道这是否有必要.
所以这似乎没问题,尽管有关于POM文件的需求以及IVY xml和源jar的版本命名的问题.但是,当我现在继续指定从一个Maven项目到公共库项目的SNAPSHOT版本之一的依赖项时,它抱怨它无法解析依赖项:
缺少神器com.smartstream.common_library:common_library_dao:罐子:4.0.0.5-4-快照:编译
我已经尝试通过POM文件为Artifactory指定存储库,并且通过Maven设置文件几乎没有成功:
<repository>
<id>test</id>
<name>simple test</name>
<url>http://server/artifactory/libs-snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
Run Code Online (Sandbox Code Playgroud)
奇怪的是,如果我让IVY将一个版本发布而不是SNAPSHOT发布到版本库的libs-release-local存储库中,那么所有内容都会按照您的预期进行解析.此外,如果我将唯一时间戳指定为依赖项版本(SNAPSHOT的替代)的一部分,它也会解析它.所以这表明Maven项目能够解决Artifactory,只是SNAPSHOT版本出现问题.
我在这个问题上几乎没有希望地挖掘高低.如果您能提供任何见解,那将非常感激.
我使用不同的常春藤配置向maven存储库发布了一些组件.作为一个例子,我采取以下方式(常春藤文档)做同样的..
<ivy-module version="1.0">
<info organisation="org.apache" module="filter"/>
<configurations>
<conf name="api" description="only provide filter framework API"/>
<conf name="homemade-impl" extends="api" description="provide a home made implementation of our api"/>
</configurations>
<publications>
<artifact name="filter-api" type="jar" conf="api" ext="jar"/>
<artifact name="filter-hmimpl" type="jar" conf="homemade-impl" ext="jar"/>
</publications>
</ivy-module>
Run Code Online (Sandbox Code Playgroud)
根据上面的配置,生成的工件是filter-api.jar和filter-hmimpl.jar,我生成了一个pom文件filter.pom并将其发布到maven存储库中.
现在,当我尝试使用以下内容解决另一个组件中的工件filter-api时..
<dependency org="org.apache" name="filter" rev="3.1" conf="default->api"/>
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我相信我的filter.pom应该包含这样的一些模块,以使其工作..
<modules>
<module>api</module>
<module>homemade-impl</module>
</modules>
Run Code Online (Sandbox Code Playgroud)
我是否正确,如果是,我怎么能将不同的常春藤配置映射到maven中的模块.