You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Charles Scott <co...@gmail.com> on 2012/08/23 21:41:04 UTC

simple upload to maven repo question





Hi, 

I am looking at ivy to see if a very simple use case can be done, similar to the mvn deploy:deploy-filei example here:


mvn deploy:deploy-file \
    -Durl=$REPO_URL \
    -DrepositoryId=$REPO_ID \
    -DgroupId=org.myorg \
    -DartifactId=myproj \
    -Dversion=1.2.3  \
    -Dpackaging=zip \
    -Dfile=myproj.zip

It appears that ivy uses a pattern based approach (ant task examples).. Does Ivy have any example similar to above which allows a simple file to be referenced and uploaded to a maven repo?  (either via ant or java invocation)

Re: simple upload to maven repo question

Posted by Alan Richardson <al...@lexmark.com>.
Attached is the verbose Ant output from running a resolve.

Here are the contained Ant resolve targets.

   <!-- Configure the Ivy environment using the Ivy settings file -->
   <target name="ivy-configure">
      <ivy:configure url="${ivy.settings.file}" />
   </target>

   <!-- Resolve and download build dependencies.
        This target can be invoked by either of two names. -->
   <target name="ivy-resolve-build" depends="ivy-resolve" />
   <target name="ivy-resolve"
           depends="ivy-configure"
           description="Retrieve build dependencies with Ivy">
      <echo message="Resolve 'build' dependencies" />
      <ivy:retrieve
pattern="${ivy.lib.dir}/[artifact](-[classifier]).[ext]" conf="build" />
   </target>

alan

Re: simple upload to maven repo question

Posted by Maarten Coene <ma...@yahoo.com>.
Alan,

could you also post the console output when doing a resolve with Ant running in verbose mode? (ant -v)

thanks,
Maarten





________________________________
 From: Alan Richardson <al...@lexmark.com>
To: ivy-user@ant.apache.org 
Sent: Friday, August 24, 2012 10:59 PM
Subject: Re: simple upload to maven repo question
 
I am now officially confused. I decided not to way on the guys to resolve
the Artifactory stability issue so I have created the corresponding
repositories on my local file system. All seemed to be working well as I
processed each component (resolve, build, publish). When I finally got the
final element that pulls everything together, I am again having the same
issue as before (Ivy can't resolve some components...sometimes). I also
accidentally discovered that the order in which I have the dependencies
listed has an effect. I am very much hoping that there is simply something
that I have configured incorrectly, because I don't want to think about the
alternative :-(.

I'll attempt to describe the problems I am having by providing the details.
Here is my Ivy settings file.
<?xml version="1.0" encoding="UTF-8"?>
<ivy-settings>
   <property name="repos.base" value="C:/Artifactory" />

   <property name="repos.release" value="${repos.base}/esf-release" />
   <property name="repos.milestone" value="${repos.base}/esf-milestone" />
   <property name="repos.integration" value="${repos.base}/esf-integration"
/>

   <settings defaultResolver="main" />

   <resolvers>
      <chain name="main" returnFirst="true">

         <filesystem name="local" checkmodified="true">
            <ivy
pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[revision]/ivy.xml"
/>
            <artifact
pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[revision]/[artifact].[ext]"
/>
         </filesystem>

         <filesystem name="integration_repository" checkmodified="true">
            <ivy
pattern="${repos.integration}/[organisation]/[module]/[revision]/ivy.xml" />
            <artifact
pattern="${repos.integration}/[organisation]/[module]/[revision]/[artifact].[ext]"
/>
         </filesystem>

         <filesystem name="milestone_repository" checkmodified="true">
            <ivy
pattern="${repos.milestone}/[organisation]/[module]/[revision](-[classification])/ivy.xml"
/>
            <artifact
pattern="${repos.milestone}/[organisation]/[module]/[revision](-[classification])/[artifact].[ext]"
/>
         </filesystem>

         <filesystem name="release_repository" checkmodified="true">
            <ivy
pattern="${repos.release}/[organisation]/[module]/[revision]/ivy.xml" />
            <artifact
pattern="${repos.release}/[organisation]/[module]/[revision](-[classification])/[artifact].[ext]"
/>
         </filesystem>

         <ibiblio name="repo" m2compatible="true" root="
http://artifactory.rds.lexmark.com:8080/artifactory/repo" />
      </chain>
   </resolvers>
</ivy-settings>

My original "problem child" is a module called vwt2. Here is its ivy.xml
file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">

<info organisation="esf" module="vwt2" revision="SNAPSHOT" />

<configurations>
<conf name="default" />
<conf name="compile_only" />
<conf name="build" visibility="private" />
</configurations>

<!-- Project Artifacts -->
<publications>
<artifact name="vwt2" ext="jar" conf="default" />
<artifact name="vwt2-lib" ext="jar" type="lib" conf="compile_only"/>
</publications>

<!-- Project Dependencies -->
<dependencies>
</dependencies>
</ivy-module>

It appears to build just fine and, with my Ant build directives, I can get
it in each repository and see exactly what I expect to see. Note that
despite having the "status=SNAPSHOT" in the file, my actual publish
directives control the actual status. My "integration" repo has overwrite
enabled since it is always the result of my continuous build system and I
don't need to keep older versions so I have it set to "revision=SNAPSHOT"
with "status=integration". When I publish it to my "milestone" repo, the
revision gets set to an actual value like "2.1.5" and "status=milestone".
When I publish it to my "release" repo, the revision stays the same and
"status=release". When I go look at the artifacts in each repo, I see
exactly what I expect to see. I use this same development pattern for all
components. By the way, when I build each component, I resolve it for the
"build" configuration; keep that in mind as you look at the various ivy.xml
files.

Now I have another module called esbase. Same development pattern and all
looks OK in all of the repos. Here is its ivm.xml file.\<?xml version="1.0"
encoding="ISO-8859-1"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">

<info organisation="esf" module="esbase" revision="SNAPSHOT" />

<configurations>
<conf name="default" />
<conf name="compile_only" />
<conf name="build" visibility="private" />
<conf name="test" extends="build" visibility="private" />
</configurations>

<!-- Project Artifacts -->
<publications>
<artifact name="esbase" ext="jar" conf="default"/>
<artifact name="esbase-lib" ext="jar" type="lib" conf="compile_only" />
<artifact name="esbaseEmbed" ext="jar" conf="default" />
</publications>

<!-- Project Dependencies -->
  <dependencies>
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default" />
<dependency org="org.mockito" name="mockito-all" rev="1.8.5"
conf="test->default" />
<dependency org="org.codehaus.sonar-plugins" name="sonar-ant-task"
rev="1.2" conf="test->default"/>
      <dependency org="net.sourceforge.cobertura" name="cobertura"
rev="1.9.4.1" conf="test->default" >
            <exclude org="org.apache.ant"/>
      </dependency>
</dependencies>
</ivy-module>

I have another module called refUi80x48 that depends on (parts of) the
esbase module and (parts of) the vwt2 module. It builds and just fine. Here
is its ivy.xml file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">

<info organisation="esf" module="refUi80x48" revision="SNAPSHOT" />

<configurations>
<conf name="default" />
<conf name="build" visibility="private" />
</configurations>

<!-- Project artifacts -->
<publications>
<artifact name="refUi80x48" ext="jar" conf="default" />
</publications>

<!-- Project dependencies -->
<dependencies>
<dependency name="esbase" rev="latest.release" conf="build->compile_only" />
<dependency name="esref_UI_interface" rev="latest.release"
conf="build->compile_only" />
<dependency name="vwt2" rev="latest.release" conf="build->compile_only" />
</dependencies>
</ivy-module>

There are several other very similar modules but I won't bother with them
here. Now when I get to my final element, named esref, things start to get
weird. Here is its ivy.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="
http://ant.apache.org/ivy/schemas/ivy.xsd">

<info organisation="esf" module="esref" revision="SNAPSHOT" />

<configurations>
<conf name="default" />
<conf name="build" visibility="private" />
<conf name="package" extends="build" visibility="private" />
</configurations>

<!-- Project Artifacts -->
<publications>
  <artifact name="esref" ext="fls" type="flash" conf="default" />
  <artifact name="esref_desc" ext="xml" type="descriptor" conf="default" />
  <artifact name="esref" ext="zip" type="package" conf="default" />
  <artifact name="esref-product" ext="zip" type="package" conf="default" />
</publications>

<!-- Project Dependencies -->
<dependencies>
<dependency name="esbase" rev="latest.release" conf="build->*" />
<dependency name="esref_UI_interface" rev="latest.release" conf="build->*"
/>
<dependency name="refUi80x48" rev="latest.release" conf="build->default" />
<dependency name="refUi64x48" rev="latest.release" conf="build->default" />
<dependency name="deviceInfo_1x" rev="latest.release"
conf="build->default" />
<dependency name="deviceInfo_2x" rev="latest.release" conf="build->default"
/>
<dependency name="imgCache_1x" rev="latest.release" conf="build->default" />
<dependency name="imgCache_2x" rev="latest.release" conf="build->default" />
<dependency name="vwt1" rev="latest.release" conf="build->default" />
<dependency name="vwt2" rev="latest.release" conf="build->default" />
</dependencies>
</ivy-module>

Notice the first dependency for the esref module; its name is esbase. This
particular file works fine, except that a build cannot find (resolve) the
vwt2 dependency. But, my confusion starts here. If I move the esbase
dependency to the empty line position, then it cannot resolve esbase.
What's with that?? I suspect that there is something about the fact that
this module needs all of esbase (*) and the module "refUi80x48" depends on
only part of on esbase. But I thought that I had made the esbase dependency
in refUi80x48 private. Surely the order of the dependency specifications
should not matter as that could quickly become unmanageable.

So somebody please tell me what I am doing wrong. What is wrong with my
configuration? I really want to be wrong because I don't want to think
about the alternative.

alan

Re: simple upload to maven repo question

Posted by Alan Richardson <al...@lexmark.com>.
I am now officially confused. I decided not to way on the guys to resolve
the Artifactory stability issue so I have created the corresponding
repositories on my local file system. All seemed to be working well as I
processed each component (resolve, build, publish). When I finally got the
final element that pulls everything together, I am again having the same
issue as before (Ivy can't resolve some components...sometimes). I also
accidentally discovered that the order in which I have the dependencies
listed has an effect. I am very much hoping that there is simply something
that I have configured incorrectly, because I don't want to think about the
alternative :-(.

I'll attempt to describe the problems I am having by providing the details.
Here is my Ivy settings file.
<?xml version="1.0" encoding="UTF-8"?>
<ivy-settings>
   <property name="repos.base" value="C:/Artifactory" />

   <property name="repos.release" value="${repos.base}/esf-release" />
   <property name="repos.milestone" value="${repos.base}/esf-milestone" />
   <property name="repos.integration" value="${repos.base}/esf-integration"
/>

   <settings defaultResolver="main" />

   <resolvers>
      <chain name="main" returnFirst="true">

         <filesystem name="local" checkmodified="true">
            <ivy
pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[revision]/ivy.xml"
/>
            <artifact
pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[revision]/[artifact].[ext]"
/>
         </filesystem>

         <filesystem name="integration_repository" checkmodified="true">
            <ivy
pattern="${repos.integration}/[organisation]/[module]/[revision]/ivy.xml" />
            <artifact
pattern="${repos.integration}/[organisation]/[module]/[revision]/[artifact].[ext]"
/>
         </filesystem>

         <filesystem name="milestone_repository" checkmodified="true">
            <ivy
pattern="${repos.milestone}/[organisation]/[module]/[revision](-[classification])/ivy.xml"
/>
            <artifact
pattern="${repos.milestone}/[organisation]/[module]/[revision](-[classification])/[artifact].[ext]"
/>
         </filesystem>

         <filesystem name="release_repository" checkmodified="true">
            <ivy
pattern="${repos.release}/[organisation]/[module]/[revision]/ivy.xml" />
            <artifact
pattern="${repos.release}/[organisation]/[module]/[revision](-[classification])/[artifact].[ext]"
/>
         </filesystem>

         <ibiblio name="repo" m2compatible="true" root="
http://artifactory.rds.lexmark.com:8080/artifactory/repo" />
      </chain>
   </resolvers>
</ivy-settings>

My original "problem child" is a module called vwt2. Here is its ivy.xml
file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">

<info organisation="esf" module="vwt2" revision="SNAPSHOT" />

<configurations>
<conf name="default" />
<conf name="compile_only" />
<conf name="build" visibility="private" />
</configurations>

<!-- Project Artifacts -->
<publications>
<artifact name="vwt2" ext="jar" conf="default" />
<artifact name="vwt2-lib" ext="jar" type="lib" conf="compile_only"/>
</publications>

<!-- Project Dependencies -->
<dependencies>
</dependencies>
</ivy-module>

It appears to build just fine and, with my Ant build directives, I can get
it in each repository and see exactly what I expect to see. Note that
despite having the "status=SNAPSHOT" in the file, my actual publish
directives control the actual status. My "integration" repo has overwrite
enabled since it is always the result of my continuous build system and I
don't need to keep older versions so I have it set to "revision=SNAPSHOT"
with "status=integration". When I publish it to my "milestone" repo, the
revision gets set to an actual value like "2.1.5" and "status=milestone".
When I publish it to my "release" repo, the revision stays the same and
"status=release". When I go look at the artifacts in each repo, I see
exactly what I expect to see. I use this same development pattern for all
components. By the way, when I build each component, I resolve it for the
"build" configuration; keep that in mind as you look at the various ivy.xml
files.

Now I have another module called esbase. Same development pattern and all
looks OK in all of the repos. Here is its ivm.xml file.\<?xml version="1.0"
encoding="ISO-8859-1"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">

<info organisation="esf" module="esbase" revision="SNAPSHOT" />

<configurations>
<conf name="default" />
<conf name="compile_only" />
<conf name="build" visibility="private" />
<conf name="test" extends="build" visibility="private" />
</configurations>

<!-- Project Artifacts -->
<publications>
<artifact name="esbase" ext="jar" conf="default"/>
<artifact name="esbase-lib" ext="jar" type="lib" conf="compile_only" />
<artifact name="esbaseEmbed" ext="jar" conf="default" />
</publications>

<!-- Project Dependencies -->
  <dependencies>
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default" />
<dependency org="org.mockito" name="mockito-all" rev="1.8.5"
conf="test->default" />
<dependency org="org.codehaus.sonar-plugins" name="sonar-ant-task"
rev="1.2" conf="test->default"/>
      <dependency org="net.sourceforge.cobertura" name="cobertura"
rev="1.9.4.1" conf="test->default" >
            <exclude org="org.apache.ant"/>
      </dependency>
</dependencies>
</ivy-module>

I have another module called refUi80x48 that depends on (parts of) the
esbase module and (parts of) the vwt2 module. It builds and just fine. Here
is its ivy.xml file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">

<info organisation="esf" module="refUi80x48" revision="SNAPSHOT" />

<configurations>
<conf name="default" />
<conf name="build" visibility="private" />
</configurations>

<!-- Project artifacts -->
<publications>
<artifact name="refUi80x48" ext="jar" conf="default" />
</publications>

<!-- Project dependencies -->
<dependencies>
<dependency name="esbase" rev="latest.release" conf="build->compile_only" />
<dependency name="esref_UI_interface" rev="latest.release"
conf="build->compile_only" />
<dependency name="vwt2" rev="latest.release" conf="build->compile_only" />
</dependencies>
</ivy-module>

There are several other very similar modules but I won't bother with them
here. Now when I get to my final element, named esref, things start to get
weird. Here is its ivy.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="
http://ant.apache.org/ivy/schemas/ivy.xsd">

<info organisation="esf" module="esref" revision="SNAPSHOT" />

<configurations>
<conf name="default" />
<conf name="build" visibility="private" />
<conf name="package" extends="build" visibility="private" />
</configurations>

<!-- Project Artifacts -->
<publications>
  <artifact name="esref" ext="fls" type="flash" conf="default" />
  <artifact name="esref_desc" ext="xml" type="descriptor" conf="default" />
  <artifact name="esref" ext="zip" type="package" conf="default" />
  <artifact name="esref-product" ext="zip" type="package" conf="default" />
</publications>

<!-- Project Dependencies -->
<dependencies>
<dependency name="esbase" rev="latest.release" conf="build->*" />
<dependency name="esref_UI_interface" rev="latest.release" conf="build->*"
/>
<dependency name="refUi80x48" rev="latest.release" conf="build->default" />
<dependency name="refUi64x48" rev="latest.release" conf="build->default" />
 <dependency name="deviceInfo_1x" rev="latest.release"
conf="build->default" />
<dependency name="deviceInfo_2x" rev="latest.release" conf="build->default"
/>
<dependency name="imgCache_1x" rev="latest.release" conf="build->default" />
<dependency name="imgCache_2x" rev="latest.release" conf="build->default" />
<dependency name="vwt1" rev="latest.release" conf="build->default" />
<dependency name="vwt2" rev="latest.release" conf="build->default" />
</dependencies>
</ivy-module>

Notice the first dependency for the esref module; its name is esbase. This
particular file works fine, except that a build cannot find (resolve) the
vwt2 dependency. But, my confusion starts here. If I move the esbase
dependency to the empty line position, then it cannot resolve esbase.
What's with that?? I suspect that there is something about the fact that
this module needs all of esbase (*) and the module "refUi80x48" depends on
only part of on esbase. But I thought that I had made the esbase dependency
in refUi80x48 private. Surely the order of the dependency specifications
should not matter as that could quickly become unmanageable.

So somebody please tell me what I am doing wrong. What is wrong with my
configuration? I really want to be wrong because I don't want to think
about the alternative.

alan

Re: simple upload to maven repo question

Posted by Maarten Coene <ma...@yahoo.com>.
There is a simple example on this page:
http://ant.apache.org/ivy/history/latest-milestone/use/publish.html

Maarten



________________________________
 From: Charles Scott <co...@gmail.com>
To: ivy-user@ant.apache.org 
Sent: Thursday, August 23, 2012 9:41 PM
Subject: simple upload to maven repo question
 





Hi, 

I am looking at ivy to see if a very simple use case can be done, similar to the mvn deploy:deploy-filei example here:


mvn deploy:deploy-file \
    -Durl=$REPO_URL \
    -DrepositoryId=$REPO_ID \
    -DgroupId=org.myorg \
    -DartifactId=myproj \
    -Dversion=1.2.3  \
    -Dpackaging=zip \
    -Dfile=myproj.zip

It appears that ivy uses a pattern based approach (ant task examples).. Does Ivy have any example similar to above which allows a simple file to be referenced and uploaded to a maven repo?  (either via ant or java invocation)