0

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 ?

sandy_ws
  • 155
  • 2
  • 14
  • Did you include a publications section in the ivy file? Does the file to be published match the artifacts section in the publish task? In the absence of more information all I can do is refer you to an example: http://stackoverflow.com/questions/8304562/issues-using-ivypublish-task/8317109#8317109 – Mark O'Connor Aug 18 '15 at 22:25
  • @MarkO'Connor It works only when your jar file is like name.jar. And my jar names vary each time e.g name.jar, name.name1.jar name.name1.name2.jar. So instead of pattern I have put ${ant.project.name}.jar. This worked. I know this is work around but i didn't find any correct solution – sandy_ws Aug 19 '15 at 05:11
  • Sorry I don't follow. The Artifact pattern is designed to adapt to the how the local file to be published is named and placed within the project workspace. How can the jar names change each time? Do you not control the logic that builds the jar? – Mark O'Connor Aug 19 '15 at 12:54
  • Yes you are right about publishing process. But when I generate jar from ant build , I am providing jar name value as ${ant.project.name} not ${ivy.module}. And I have around 500 projects whose names keeps changing, thats why used this workaround. – sandy_ws Aug 20 '15 at 05:22
  • Sounds like you're trying to use a single ivy file to publish the output of 500 projects? Why don't you simplify your setup and let each module have it's own ivy file and let each module publish separately into a central repository? Although it sounds more complicated it simplifies everything in the long run since each module becomes standalone dependent only on artefacts in the repository. Repositories are in turn also easy to setup, just download Nexus, Artifactory or Archiva – Mark O'Connor Aug 20 '15 at 10:38
  • In case this is an issue with trying to make a common inherited build file work across multiple projects, another tip is to package common build logic as Antlibs. Ivy can be used to manage this common logic (as just another dependency) and enables build logic to be versioned. No more fear of updates breaking 500+ projects. See the following answer for an example: http://stackoverflow.com/questions/15643191/how-to-manage-a-common-ant-build-script-across-multiple-project-build-jobs-on-je/15647898#15647898 – Mark O'Connor Aug 20 '15 at 11:01

1 Answers1

0

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

Quiles
  • 1