Hi, currently my project has a publish task to the local ivy cache and it
(looks to) works.
The issue is the IvyDE is not able to pickup the sources as it reads a
ivy.xml from repo that doesn't have the sources configuration.
Let me say that the modules and artifacts are published to the ivy local
cache.
I see that ivy creates a ivy-${version}.xml and
ivydata-${version}.properties at ${ivy.cache.dir}/[organisation]/[artifact]/
when ivy resolves the dependency (see 8 below)
The publish task (see 3 below) creates the following directories: jars and
sources
${ivy.cache.dir}/[organisation]/[artifact]/[type]s/
I see that if I manually change the
${ivy.cache.dir}/[organisation]/[artifact]/ivy-1.1-SNAPSHOT.xml to include
the sources configuration, IvyDE can pickup the sources instantly.
If I uncomment the <ivy pattern=... at ivysettings.xml the
ivy-1.1-SNAPSHOT.xml is published to the [organisation]/[artifact] directory
but the resolve task of the other project (who dependes of
commons-framework) fails (see 9 below).
In this case looks the ivydata-1.1-SNAPSHOT.properties is missing.
I ask:
a) is there any best practice to use the local repo and ivy cache as the
same directory ?
b) Having the local repository the same as the ivy cache, how to publish the
sources and have it resolved by IvyDE ?
Thanks
Claudio
See the pertinent configurations:
==> 1) ivy.xml
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven" >
<info module="commons-framework" organisation="com.corps"
revision="${version}"/>
<configurations>
<conf name="compile" extends="runtime"/>
<conf name="runtime" transitive="false" />
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="${ant.project.name}" type="jar" ext="jar"
conf="compile" />
<artifact name="${ant.project.name}" type="source" ext="jar"
m:classifier="sources" conf="compile"/>
</publications>
<dependencies>
some dependencies...
</dependencies>
</ivy-module>
=================================================================
==> 2) ivysettings.xml
<ivysettings>
<!-- The import order is important -->
<!-- The build-local must override build-shared -->
<properties file="build-shared.properties" />
<properties file="build-local.properties" />
<settings defaultResolver="default" />
<resolvers>
<ibiblio name="repo-corps" m2compatible="true" usepoms="false"
root="${nexus.host_port}/nexus/content/groups/public/" />
<filesystem name="local-ivy-cache">
<!-- <ivy
pattern="${local.ivy.cache.dir}/[organisation]/[module]/[artifact]-[revision](-[classifier]).[ext]"
/> -->
<artifact
pattern="${local.ivy.cache.dir}/[organisation]/[module]/[type]s/[artifact]-[revision](-[classifier]).[ext]"
/>
</filesystem>
<chain name="default" returnFirst="true">
<resolver ref="local-ivy-cache"/>
<resolver ref="repo-corps"/>
</chain>
</resolvers>
<caches defaultCacheDir="${local.ivy.cache.dir}" checkUpToDate="true" />
</ivysettings>
=================================================================
==> 3) publish task at build.xml
<target name="publish" description="==> Copy the JAR file to the ivy local
cache (local disk).">
<mkdir dir="${dist.dir}/source" />
<jar basedir="${src.dir}"
destfile="${dist.dir}/source/${ant.project.name}-${version}-sources.jar" />
<ivy:publish forcedeliver="true" overwrite="true" update="true"
resolver="local-ivy-cache" pubrevision="${version}" >
<artifacts
pattern="${dist.dir}/[type]/[artifact]-[revision](-[classifier]).[ext]" />
</ivy:publish>
<echo message="project ${ant.project.name} released with version
${ivy.revision}" />
</target>
=================================================================
==> 4) The dist directory
C:\alphaworks_corps\commons-framework\dist\ivy\ivy-1.1-SNAPSHOT.xml
C:\alphaworks_corps\commons-framework\dist\jar\commons-framework-1.1-SNAPSHOT.jar
C:\alphaworks_corps\commons-framework\dist\source\commons-framework-1.1-SNAPSHOT-sources.jar
=================================================================
==> 5) The dist\ivy\ivy-1.1-SNAPSHOT.xml
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="com.corps" module="commons-framework"
revision="1.1-SNAPSHOT" status="integration" publication="20100225135226"/>
<configurations>
<conf name="compile" extends="runtime"/>
<conf name="runtime" transitive="false"/>
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="commons-framework" type="jar" ext="jar"
conf="compile"/>
<artifact name="commons-framework" type="source" ext="jar"
m:classifier="sources" conf="compile"/>
</publications>
<dependencies>
some dependencies
</dependencies>
</ivy-module>
=================================================================
==> 6) At the ivy.cache.dir=c:/temp/ivy-cache
C:\temp\ivy-cache\com.corps\commons-framework\jars
25/02/2010 13:52 94.242 commons-framework-1.1-SNAPSHOT.jar
25/02/2010 13:52 32 commons-framework-1.1-SNAPSHOT.jar.md5
25/02/2010 13:52 40 commons-framework-1.1-SNAPSHOT.jar.sha1
C:\temp\ivy-cache\com.corps\commons-framework
25/02/2010 13:52 <DIR> ivys
25/02/2010 13:52 <DIR> jars
25/02/2010 13:52 <DIR> sources
C:\temp\ivy-cache\com.corps\commons-framework\ivys
25/02/2010 13:52 2.148 ivy-1.1-SNAPSHOT.xml
25/02/2010 13:52 32 ivy-1.1-SNAPSHOT.xml.md5
25/02/2010 13:52 40 ivy-1.1-SNAPSHOT.xml.sha1
=================================================================
==> 7) other project that have commons-framework-1.1-SNAPSHOT.jar as
dependency
ant compile
[ivy:resolve] found com.corps#commons-framework;1.1-SNAPSHOT in
local-ivy-cache
=================================================================
==> 8) after 7) does an 'ant compile'
C:\temp\ivy-cache\com.corps\commons-framework
25/02/2010 14:20 445 ivy-1.1-SNAPSHOT.xml
25/02/2010 14:20 161 ivydata-1.1-SNAPSHOT.properties
type C:\temp\ivy-cache\com.corps\commons-framework\ivy-1.1-SNAPSHOT.xml
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="1.0">
<info organisation="com.corps"
module="commons-framework"
revision="1.1-SNAPSHOT"
status="release"
publication="20100225142018"
default="true"
/>
<configurations>
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="commons-framework" type="jar" ext="jar"
conf="default"/>
</publications>
</ivy-module>
It doesn't have the 'source' configuration
=================================================================
==> 9) 'ant compile' when publish task copy the
dist\ivys\ivy-1.1-SNAPSHOT.xml to
C:\temp\ivy-cache\com.corps\commons-framework\ivy-1.1-SNAPSHOT.xml
In this case looks the ivydata-1.1-SNAPSHOT.properties is missing
[ivy:resolve] found com.corps#commons-framework;1.1-SNAPSHOT in default
[ivy:resolve] :: resolution report :: resolve 218ms :: artifacts dl 0ms
---------------------------------------------------------------------
| | modules || artifacts
|
| conf | number| search|dwnlded|evicted||
number|dwnlded|
---------------------------------------------------------------------
| compile | 5 | 0 | 0 | 0 || 4 | 0
|
---------------------------------------------------------------------
[ivy:resolve]
[ivy:resolve] :: problems summary ::
[ivy:resolve] :::: ERRORS
[ivy:resolve] unknown resolver null
[ivy:resolve] unknown resolver null
[ivy:resolve]
-----
Claudio Miranda
http://weblogs.java.net/blog/claudio
http://www.claudius.com.br/blog
--
View this message in context: http://old.nabble.com/Publish-ivydata-for-source-type-tp27714488p27714488.html
Sent from the ivy-user mailing list archive at Nabble.com.
|