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 Claudio Miranda <cl...@claudius.com.br> on 2010/01/27 23:28:14 UTC

Publish the source jar - the jar file is the binary

Hi, I am having some troubles getting the source publication to work.

The ivy.xml
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
    <info module="${ant.project.name}" organisation="com.company"
revision="${version}"/>
    <configurations>
        <conf name="compile" extends="runtime"/>
        <conf name="runtime" transitive="false" />
    </configurations>
    <publications>
        <artifact name="${ant.project.name}"  type="jar" ext="jar"/>
        <artifact name="${ant.project.name}-source"  type="source" ext="jar"
/>
    </publications>
    <dependencies>
        <dependency org="com.company" name="report-commons" rev="1.0"
conf="compile->default"  />
        <dependency org="com.company" name="commons-framework" rev="0.1"
conf="compile->default" />
    </dependencies>
</ivy-module>



The relevant build.xml related to publish
<ivy:publish overwrite="true" resolver="local-ivy-cache">
    <artifacts pattern="${dist.dir}/[module]-[revision].[ext]" />
    <artifacts pattern="${dist.dir}/[module]-[revision]-source.[ext]" />
</ivy:publish>

The ant output
publish:
      [jar] Building jar:
c:\alphaworks_company\report-web\report-provider\dist\report-provider-1.6-source.jar
[ivy:publish] :: loading settings :: file =
c:\alphaworks_company\report-web\ivysettings.xml
:: delivering :: com.company#report-provider;1.6 :: 1.6 :: integration ::
Wed Jan 27 20:21:02 BRST 2010
        delivering ivy file to
c:\alphaworks_company\report-web\report-provider\dist\report-provider-1.6.xml
:: publishing :: com.company#report-provider
        published report-provider to
c:/temp/ivy-cache/com.company/report-provider/jars/report-provider-1.6.jar
        published report-provider-source to
c:/temp/ivy-cache/com.company/report-provider/sources/report-provider-source-1.6.jar
        published ivy to
c:/temp/ivy-cache/com.company/report-provider/ivys/ivy-1.6.xml


The
c:/temp/ivy-cache/com.company/report-provider/sources/report-provider-source-1.6.jar
is the same file as
c:/temp/ivy-cache/com.company/report-provider/jars/report-provider-1.6.jar

The generated jar files at report-provider\dist are (they are correct)
 report-provider-1.6-source.jar - size 6.003
 report-provider-1.6.jar        - size 9.152



So, how to publish the source jar file correctly ?

Thanks

Claudio 

-----
Claudio Miranda
http://weblogs.java.net/blog/claudio
http://www.claudius.com.br/blog
-- 
View this message in context: http://old.nabble.com/Publish-the-source-jar---the-jar-file-is-the-binary-tp27347927p27347927.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Publish the source jar - the jar file is the binary

Posted by Claudio Miranda <cl...@claudius.com.br>.
Thanks topher,

I managed to get it to work but have changed the structure as the jar files
are under a specific directory, as follows

Previously the dist  directory contained the jar files
28/01/2010  10:30             6.003 report-provider-source.jar
28/01/2010  10:30             9.152 report-provider.jar

Now the dist  directory contained the jar files

dist\jar
8/01/2010  10:55             9.152 report-provider.jar

dist\source
8/01/2010  10:55             6.003 report-provider.jar

The publish task
<ivy:publish overwrite="true" resolver="local-ivy-cache" >
    <artifacts pattern="${dist.dir}/[type]/[artifact].[ext]" />
</ivy:publish>

At the ivy cache they are
c:\temp\ivy-cache\com.company\report-provider\jars

28/01/2010  10:55             9.152 report-provider-1.6.jar

c:\temp\ivy-cache\com.company\report-provider\sources

28/01/2010  10:55             6.003 report-provider-1.6.jar

You can see the published source jar file has not the "source" word appended
to the file name.

Is it possible to have jar and source files at dist directory (not under the
subdirectories) and have the publish them at the ivy cache ?


topher1120 wrote:
> 
> My ivy.xml and publish target are slightly different.  I also have a maven
> classifier on my artifacts.  First, in ivy.xml, I added xmlns:m="*
> http://ant.apache.org/ivy/maven*" to the ivy-module definition.
> My artifact definitions are such:
> <artifact conf="*default*" name="*sers-client*" type="*jar*" ext="*jar*"
> />
>   <artifact conf="*default*" name="*sers-client*" type="*source*"
> ext="*jar*
> " m:classifier="*sources*" />
>    <artifact conf="*default*" name="*sers-client*" type="*javadoc*" ext="*
> jar*" m:classifier="*javadoc*" />
> 
> In ant, I separated the files by type into their own directory, so once
> everything builds, but before the publish, the structure looks like:
> dist
>   - jar
>      - sers-client.jar
>   - source
>      - sers-client.jar
>   - javadoc
>      - sers-client.jar
> 
> My publish target then looks like:
> <ivy:publish pubrevision="*${ivyPubRevision}*"
> resolver="*${ivyPubResolver}*
> " update="*true*" overwrite="*true*">
>    <artifacts pattern="*${dist}/[type]/[artifact].[ext]*" />
> </ivy:publish>
> 
> When this publishes, I get sers-client-2.0.jar,
> sers-client-2.0-sources.jar
> and sers-client-2.0-javadoc.jar in my repo.
> There might be a better way, but I haven't found it.
> 
> Hope this helps.
> 
> Thanks,
> topher
> 
> 
> On Wed, Jan 27, 2010 at 3:28 PM, Claudio Miranda
> <cl...@claudius.com.br>wrote:
> 
>>
>> Hi, I am having some troubles getting the source publication to work.
>>
>> The ivy.xml
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ivy-module version="2.0">
>>    <info module="${ant.project.name}" organisation="com.company"
>> revision="${version}"/>
>>    <configurations>
>>        <conf name="compile" extends="runtime"/>
>>        <conf name="runtime" transitive="false" />
>>    </configurations>
>>    <publications>
>>        <artifact name="${ant.project.name}"  type="jar" ext="jar"/>
>>        <artifact name="${ant.project.name}-source"  type="source"
>> ext="jar"
>> />
>>    </publications>
>>    <dependencies>
>>        <dependency org="com.company" name="report-commons" rev="1.0"
>> conf="compile->default"  />
>>        <dependency org="com.company" name="commons-framework" rev="0.1"
>> conf="compile->default" />
>>    </dependencies>
>> </ivy-module>
>>
>>
>>
>> The relevant build.xml related to publish
>> <ivy:publish overwrite="true" resolver="local-ivy-cache">
>>    <artifacts pattern="${dist.dir}/[module]-[revision].[ext]" />
>>    <artifacts pattern="${dist.dir}/[module]-[revision]-source.[ext]" />
>> </ivy:publish>
>>
>> The ant output
>> publish:
>>      [jar] Building jar:
>>
>> c:\alphaworks_company\report-web\report-provider\dist\report-provider-1.6-source.jar
>> [ivy:publish] :: loading settings :: file =
>> c:\alphaworks_company\report-web\ivysettings.xml
>> :: delivering :: com.company#report-provider;1.6 :: 1.6 :: integration ::
>> Wed Jan 27 20:21:02 BRST 2010
>>        delivering ivy file to
>>
>> c:\alphaworks_company\report-web\report-provider\dist\report-provider-1.6.xml
>> :: publishing :: com.company#report-provider
>>        published report-provider to
>> c:/temp/ivy-cache/com.company/report-provider/jars/report-provider-1.6.jar
>>        published report-provider-source to
>>
>> c:/temp/ivy-cache/com.company/report-provider/sources/report-provider-source-1.6.jar
>>        published ivy to
>> c:/temp/ivy-cache/com.company/report-provider/ivys/ivy-1.6.xml
>>
>>
>> The
>>
>> c:/temp/ivy-cache/com.company/report-provider/sources/report-provider-source-1.6.jar
>> is the same file as
>> c:/temp/ivy-cache/com.company/report-provider/jars/report-provider-1.6.jar
>>
>> The generated jar files at report-provider\dist are (they are correct)
>>  report-provider-1.6-source.jar - size 6.003
>>  report-provider-1.6.jar        - size 9.152
>>
>>
>>
>> So, how to publish the source jar file correctly ?
>>
>> Thanks
>>
>> Claudio
>>
>> -----
>> Claudio Miranda
>> http://weblogs.java.net/blog/claudio
>> http://www.claudius.com.br/blog
>> --
>> View this message in context:
>> http://old.nabble.com/Publish-the-source-jar---the-jar-file-is-the-binary-tp27347927p27347927.html
>> Sent from the ivy-user mailing list archive at Nabble.com.
>>
>>
> 
> 


-----
Claudio Miranda
http://weblogs.java.net/blog/claudio
http://www.claudius.com.br/blog
-- 
View this message in context: http://old.nabble.com/Publish-the-source-jar---the-jar-file-is-the-binary-tp27347927p27355652.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Publish the source jar - the jar file is the binary

Posted by Chris Marks <to...@gmail.com>.
My ivy.xml and publish target are slightly different.  I also have a maven
classifier on my artifacts.  First, in ivy.xml, I added xmlns:m="*
http://ant.apache.org/ivy/maven*" to the ivy-module definition.
My artifact definitions are such:
<artifact conf="*default*" name="*sers-client*" type="*jar*" ext="*jar*" />
  <artifact conf="*default*" name="*sers-client*" type="*source*" ext="*jar*
" m:classifier="*sources*" />
   <artifact conf="*default*" name="*sers-client*" type="*javadoc*" ext="*
jar*" m:classifier="*javadoc*" />

In ant, I separated the files by type into their own directory, so once
everything builds, but before the publish, the structure looks like:
dist
  - jar
     - sers-client.jar
  - source
     - sers-client.jar
  - javadoc
     - sers-client.jar

My publish target then looks like:
<ivy:publish pubrevision="*${ivyPubRevision}*" resolver="*${ivyPubResolver}*
" update="*true*" overwrite="*true*">
   <artifacts pattern="*${dist}/[type]/[artifact].[ext]*" />
</ivy:publish>

When this publishes, I get sers-client-2.0.jar, sers-client-2.0-sources.jar
and sers-client-2.0-javadoc.jar in my repo.
There might be a better way, but I haven't found it.

Hope this helps.

Thanks,
topher


On Wed, Jan 27, 2010 at 3:28 PM, Claudio Miranda <cl...@claudius.com.br>wrote:

>
> Hi, I am having some troubles getting the source publication to work.
>
> The ivy.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <ivy-module version="2.0">
>    <info module="${ant.project.name}" organisation="com.company"
> revision="${version}"/>
>    <configurations>
>        <conf name="compile" extends="runtime"/>
>        <conf name="runtime" transitive="false" />
>    </configurations>
>    <publications>
>        <artifact name="${ant.project.name}"  type="jar" ext="jar"/>
>        <artifact name="${ant.project.name}-source"  type="source"
> ext="jar"
> />
>    </publications>
>    <dependencies>
>        <dependency org="com.company" name="report-commons" rev="1.0"
> conf="compile->default"  />
>        <dependency org="com.company" name="commons-framework" rev="0.1"
> conf="compile->default" />
>    </dependencies>
> </ivy-module>
>
>
>
> The relevant build.xml related to publish
> <ivy:publish overwrite="true" resolver="local-ivy-cache">
>    <artifacts pattern="${dist.dir}/[module]-[revision].[ext]" />
>    <artifacts pattern="${dist.dir}/[module]-[revision]-source.[ext]" />
> </ivy:publish>
>
> The ant output
> publish:
>      [jar] Building jar:
>
> c:\alphaworks_company\report-web\report-provider\dist\report-provider-1.6-source.jar
> [ivy:publish] :: loading settings :: file =
> c:\alphaworks_company\report-web\ivysettings.xml
> :: delivering :: com.company#report-provider;1.6 :: 1.6 :: integration ::
> Wed Jan 27 20:21:02 BRST 2010
>        delivering ivy file to
>
> c:\alphaworks_company\report-web\report-provider\dist\report-provider-1.6.xml
> :: publishing :: com.company#report-provider
>        published report-provider to
> c:/temp/ivy-cache/com.company/report-provider/jars/report-provider-1.6.jar
>        published report-provider-source to
>
> c:/temp/ivy-cache/com.company/report-provider/sources/report-provider-source-1.6.jar
>        published ivy to
> c:/temp/ivy-cache/com.company/report-provider/ivys/ivy-1.6.xml
>
>
> The
>
> c:/temp/ivy-cache/com.company/report-provider/sources/report-provider-source-1.6.jar
> is the same file as
> c:/temp/ivy-cache/com.company/report-provider/jars/report-provider-1.6.jar
>
> The generated jar files at report-provider\dist are (they are correct)
>  report-provider-1.6-source.jar - size 6.003
>  report-provider-1.6.jar        - size 9.152
>
>
>
> So, how to publish the source jar file correctly ?
>
> Thanks
>
> Claudio
>
> -----
> Claudio Miranda
> http://weblogs.java.net/blog/claudio
> http://www.claudius.com.br/blog
> --
> View this message in context:
> http://old.nabble.com/Publish-the-source-jar---the-jar-file-is-the-binary-tp27347927p27347927.html
> Sent from the ivy-user mailing list archive at Nabble.com.
>
>