I tried to use the new Tycho feature for renaming the produced artifact.
The zip files are renamed correctly under the target/products directory, but when Maven installs them to C:\.m2, they will have the original name.
<configuration>
<products>
<product>
<id>my.product.id</id>
<archiveFileName>xyz</archiveFileName>
</product>
</products>
</configuration>
Result in target/products directory: xyz-win32.win32.x86.zip
Result in C:\.m2...\: my.product.id-win32.win32.x86.zip
Is there another place to configure this?
After several days of thinking, I have the solution, that there is no solution.
It's not possible to rename the artifact in the maven repository. How would maven find the artifact in case of a renamed zip file.
The only place to rename the zip file is in the target directory and work on from this place.
Related
I have a little sandbox that I use to publish not-invented-here artifacts to our artifact repository. It has a common build.xml file and a common ivysettings.xml.
I would like to be able to pass the name of the ivy.xml file so I can have exactly one, uniquely-named someartifact-ivy.xml file per artifact I intend to publish.
I tried the following:
#/bin/sh
ant publish -Divy.settings.file=ivy-external-ivysettings.xml -Divy.dep.file=someartifact-ivy.xml
Property -Divy.settings.file=ivy-external-ivysettings.xml succeeds in causing ivy to use my ivy-external-ivysettings.xml file.
However, ivy seems to ignore property -Divy.dep.file=someartifact-ivy.xml and goes looking for ivy.xml instead.
The docs suggest to me that my approach should work, as does an upvoted (currently x6) answer to a similar question.
I am publishing jar file in nexus using ivy:publish.
My jar file name is shared.project.mainline.jar.
Providing this default pattern
<artifacts pattern="${build.dir}/lib/[artifact].[ext]"/>
But getting below error while publishing
impossible to publish artifacts for shared#project;mainline:
java.io.IOException: missing artifact
shared#project;mainline!project.jar
So how can I change default pattern ?
If running ivy through ant, add " artifactspattern="pattern" " to wherever you are running publish.
If that doesn't work, perhaps it is looking in the right place, but not finding the correct jar.
If so, are you defining the artifact correctly in your ivy file? What does your ivy file look like?
You will want to define the artifact specifically in the ivy file for the module
<artifact *name="artifactname"* type="jar" ext="jar" />
Make sure the name attribute is correctly set
I'm still struggling with figuring out how to integrate Apache Ivy into my somewhat complex Ant build.
If it matters, I'm using ATG Dynamo, which contributes most of the mess I'm trying to deal with.
The result of a build of a module is a "build" directory, with several subdirectories. I need to publish the entire contents of the "build" directory, along with a properties file (env/default.properties) that is not produced by the build, but one property in that file is needed when later retrieving this artifact, as it indicates the absolute path (relative to another property setting) where the contents of the "build" directory need to be installed.
The entire build will have several similarly structured modules. I'm pretty sure the target that does the "ivy:publish" can be defined in a "base" build script that all the module build scripts import.
I imagine the "ivy.xml" for each module would have a "publications" element that specifies the two (?) pieces that are being published, being the "build" directory and the "env/default.properties" file. I've never seen an example that publishes a directory, is that possible? If not, then I would guess that I'd have to specify more processing and detail in the "ivy:publish" target, such that I would first zip up the "build" directory and the "env/default.properties" file both into a zip file and publish that as the single artifact. Is this more likely?
It is quite new in Ivy, and it is not released yet, but there is a concept of "packaging" which can handle directories.
See the official documentation: http://ant.apache.org/ivy/history/trunk/concept.html#packaging
With this feature, Ivy can handle by itself the unzipping of a folder. On the publish part, you are on your own, you'll have to make a zip yourself. On the retrieve part, Ivy will unzip the folder in the cache. So you will still have to do some process to copy it at the proper place.
It has not been tested, but probably you can go even further by implementing a custom unpacking algorithm, which will do the unpacking at the proper place. You'll have to implement a class which extends org.apache.ivy.core.pack.ArchivePacking, and declare it in your ivysettings.xml, like this:
<ivysetting>
<classpath file="${ivy.settings.dir}/custom-packing.jar"/>
<typedef name="customPacking" classname="com.acme.ivy.CustomPacking" />
<customPacking />
</ivysettings>
And then in your ivy.xml, declare your artifact as packaged by your custom packaging name:
<ivy-module version="1.0">
...
<publications>
<artifact name="mydistrib" type="distrib" ext=".zip" packaging="my-custom-packaging" />
</publications>
</ivy-module>
I'm working within a large build system that uses Ant/Ivy. I try to use a predefined ant task that uses ivy:publish ant task and get this error:
impossible to publish artifacts for com.company.project1.proj1#MySupportJar;working#server1: java.io.FileNotFoundException: /path_to/ivy-repository/com.company.project1.proj1/MySupportJar/5.1.3.part/MySupportJar-5.1.3.jar (No such file or directory)
The directory in the error message exists up to the version number part (5.1.3.part).
I am new to Ivy but think I get the basics of how it works. I can not find much on the exact meaning of this error so if someone could help or point me to an explanation I think I could resolve the issue from there.
Ant target
<target name="publish-shared" depends="ivyInit, resolve"
description="Publish to the shared repository">
<ivy:publish pubrevision="5.1.3"
resolver="shared"
pubdate="${timestamp}"
forcedeliver="true"
update="true"
conf="distro, docs">
<artifacts pattern="dist/[artifact].[ext]"/>
</ivy:publish>
</target>
Ivy file snippet
<publications>
<artifact name="MySupportJar" type="jar" conf="distro" />
<artifact name="MySupportJar-source" type="source" ext="jar" conf="docs" />
</publications>
Thanks.
Thanks for all the suggestions. Turns out to be a simple solution that I was not looking for.
The problem was permissions at /path_to/ivy-repository/com.company.project1. I did not have write permission. The .part file is a temporary file written by Ivy. Ivy could not write the temporary file so when it got to reading the file it failed to find it.
I'm answering this so that it might help someone later.
Thanks.
I'm fairly new to Ant with Ivy too. What I've done is combine a local Maven repository (Artifactory), with Jenkins as a continuous integration server. When we build a jar, I also produce the Maven pom.xml with it. Then, I use the mvn deploy:file command to deploy the desired build to our Maven repository.
The developer manually deploys the jar to our Maven repository via the Promoted Build plugin to Jenkins. The developer selects the build to deploy to Maven, and then pretty much presses a button, and that build will be deployed.
I actually produce two pomswith each build. One ispom.xmland the other ispom-snapshot.xml`. We deploy the snapshot with each build, so other developers can use the latest jar instead of the officially deployed one. I've put the whole thing in github if you're interested.
The only decent Ant/Ivy documentation I've seen is Manning's Ant in Action by Steve Loughram. If it wasn't for that, I probably would have never even tried Ant with Ivy. The online Ant/Ivy documentation at Apache is just plain awful.
I've looked over what you have. I suspect it might be an issue with your ivy-settings.xml file. Somewhere, it's getting the part string as the valid location for publishing the file. Otherwise, I have no idea.
As I said, we use a Maven repository for our site repository, and then use Maven to actually deploy the jars to the repository. I simply found that much easier to do it that way than to figure out how to do this in pure Ivy. Besides, it also means that our Maven projects can also use the jars from our Ant/Ivy projects.
I'm trying to learn how to use ivy and would like to setup a local repository of the .jar files I've downloaded.
Where do you put the ivysettings.xml file? Does it go in the ant library directory?
If you'll allow me to clarify, the ivysettings.xml is the configuration of your development environment as a whole. It is not related to the repository items themselves. Generally speaking, ivysettings.xml should sit alongside your main build.xml, so that when you put
<ivy:settings file="ivysettings.xml"/>
in your build.xml, it just finds it in the current directory.
This file is completely distinct from the ivy.xml files that describe the various modules in your repository. These sit alongside the published artifacts in the repo.
You can place your ivysettings.xml file anywhere you want and you simply reference it in your Ant script with:
<ivy:settings file="ivysettings.xml"/>
If you are developing several projects, you will notice that you typically use the same ivysettings.xml file everywhere and there's no point in copy/pasting this file manually.
What I do is define one ivysettings.xml file that is checked out by all my other projects using svn:externals.
I have had the same fun with this toady, and have found you can put the ivysettings.xml file anywhere you like, but you simply reference this location on the commandline when you come to use it. e.g. You can call Ivy from NAnt something like this:
<exec program="java"
commandline=" ... ...
-jar [location of .jar file]
-settings [location of ivysettings.xml file]
... ..."
/>
(where ... means something uninteresting has been removed to save space)
Reference:
ivy settings doc