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 "Lewis, Eric" <Er...@ipi.ch> on 2008/09/09 14:37:58 UTC

How to publish source JAR?

Newbie is back  :-)

Somehow I don't get it: How can I publish my JAR with the source files?
>From what I understand, I can publish my JAR locally, by using

        <ivy:publish resolver="local" overwrite="true"
pubrevision="${project.version}">
            <artifacts
pattern="${target.dir}/[artifact]-[revision].[ext]" />
        </ivy:publish>

This works fine, but I also want to publish my source JAR. But

        <ivy:publish resolver="local" overwrite="true"
pubrevision="${project.version}">
            <artifacts
pattern="${target.dir}/[artifact]-[revision].[ext]" />
            <artifacts
pattern="${target.dir}/[artifact]-[revision]-sources.[ext]" />
        </ivy:publish>

doesn't publish the util-3.0.5-sources.jar from my util project.

Also, is there any reference for the [] variables? I thought (from
looking at my IvyDE configuration) that perhaps the following could work

            ...
            <artifacts
pattern="${target.dir}/[artifact]-[revision][source].[ext]" />
            ...

or
            ...
            <artifacts
pattern="${target.dir}/[artifact]-[revision]-[source].[ext]" />
            ...
?

Any help is greatly appreciated!

Thanks,
Eric

RE: How to publish source JAR?

Posted by "Becheanu, Daniel" <db...@cars.com>.
In org.apache.ivy.core.module.id
There is a html file describing this package. 
Quote.

" Text Representation

These classes share an homogeneous text representation, which can be
easily obtained through the toString() method.

The general pattern is:
[organisation]#[module]#[branch];[revision]![artifact].[ext]([type]) The
# before the branch is present only if the branch is not empty.
The type and surrounding parenthesis are present only if different from
the extension.

A textual representation can be parsed into an object (supported for
ModuleRevisionId only yet), as long as a strict set of characters is
used for each field (which is recommended).
Allowed characters are:

    * organisation
    * a-z A-Z 0-9 - / . _ + = module
    * a-z A-Z 0-9 - / . _ + = branch
    * a-z A-Z 0-9 - / . _ + = revision
    * a-z A-Z 0-9 - / . _ + = , [ ] { } ( ) : @ artifact
    * a-z A-Z 0-9 - / . _ + = extension
    * a-z A-Z 0-9 - / . _ + = type
      a-z A-Z 0-9 - / . _ + ="


And btw is javadoc published anywhere?

Daniel
-----Original Message-----
From: Lewis, Eric [mailto:Eric.Lewis@ipi.ch] 
Sent: Tuesday, September 09, 2008 7:38 AM
To: ivy-user@ant.apache.org
Subject: How to publish source JAR?

Newbie is back  :-)

Somehow I don't get it: How can I publish my JAR with the source files?
>From what I understand, I can publish my JAR locally, by using

        <ivy:publish resolver="local" overwrite="true"
pubrevision="${project.version}">
            <artifacts
pattern="${target.dir}/[artifact]-[revision].[ext]" />
        </ivy:publish>

This works fine, but I also want to publish my source JAR. But

        <ivy:publish resolver="local" overwrite="true"
pubrevision="${project.version}">
            <artifacts
pattern="${target.dir}/[artifact]-[revision].[ext]" />
            <artifacts
pattern="${target.dir}/[artifact]-[revision]-sources.[ext]" />
        </ivy:publish>

doesn't publish the util-3.0.5-sources.jar from my util project.

Also, is there any reference for the [] variables? I thought (from
looking at my IvyDE configuration) that perhaps the following could work

            ...
            <artifacts
pattern="${target.dir}/[artifact]-[revision][source].[ext]" />
            ...

or
            ...
            <artifacts
pattern="${target.dir}/[artifact]-[revision]-[source].[ext]" />
            ...
?

Any help is greatly appreciated!

Thanks,
Eric

RE: How to publish source JAR?

Posted by "Seaborne, Andy" <an...@hp.com>.
Xavier - thanks.  That looks like exactly what I need (for the obvious reasons for exporting to and working with Maven projects).

        Andy

> -----Original Message-----
> From: Xavier Hanin [mailto:xavier.hanin@gmail.com]
> Sent: 16 September 2008 09:18
> To: ivy-user@ant.apache.org
> Subject: Re: How to publish source JAR?
>
> On Mon, Sep 15, 2008 at 3:57 PM, Seaborne, Andy
> <an...@hp.com>wrote:
>
> > Adrian,
> >
> > Thanks for pointing that out.  I've been trying to achieve much the same
> as
> > Eric has and I now have this form working.
> >
> >
> > What I'd really like though is to make the sources result look like
> > "acme-9.8.7-sources.jar" and have not found a way to do that because the
> > artifact name is split.
>
>
> You can use an extra attribute for this, as Ivy does for maven 2 artifacts
> which look exactly as you want. In m2 they call this a classifier, so your
> pattern could be [artifact]-[revision](-[classifier]).[ext]
>
> Xavier
>
>
> >
> >
> > Anyone got any ideas for this? (hopefully, I'm just missing something
> > obvious ...)
> >
> >        Andy
> >
> > > -----Original Message-----
> > > From: Adrian Woodhead [mailto:adrian@last.fm]
> > > Sent: 9 September 2008 14:51
> > > To: ivy-user@ant.apache.org
> > > Subject: Re: How to publish source JAR?
> > >
> > > Well, assuming your build creates two jar files, say acme.jar and
> > > acme-source.jar I would do the following...
> > >
> > > In ivy.xml add two publications:
> > >
> > >   <publications>
> > >     <artifact name="acme" ext="jar"/>
> > >     <artifact name="acme-source" ext="jar"/>
> > >   </publications>
> > >
> > > Then your publish target should have one pattern like so:
> > >
> > > pattern="${target.dir}/[artifact]-[revision].[ext]" />
> > >
> > >
> > > and that should publish both jar files. What you tried to do with
> having
> > > two "artifacts" patterns within publish doesn't work as Ivy only uses
> > > the first pattern and ignores the other one.
> > >
> > > Let us know if that works for you.
> > >
> > > Regards,
> > >
> > > Adrian
> > >
> > > Lewis, Eric wrote:
> > > > Newbie is back  :-)
> > > >
> > > > Somehow I don't get it: How can I publish my JAR with the source
> files?
> > > > From what I understand, I can publish my JAR locally, by using
> > > >
> > > >         <ivy:publish resolver="local" overwrite="true"
> > > > pubrevision="${project.version}">
> > > >             <artifacts
> > > > pattern="${target.dir}/[artifact]-[revision].[ext]" />
> > > >         </ivy:publish>
> > > >
> > > > This works fine, but I also want to publish my source JAR. But
> > > >
> > > >         <ivy:publish resolver="local" overwrite="true"
> > > > pubrevision="${project.version}">
> > > >             <artifacts
> > > > pattern="${target.dir}/[artifact]-[revision].[ext]" />
> > > >             <artifacts
> > > > pattern="${target.dir}/[artifact]-[revision]-sources.[ext]" />
> > > >         </ivy:publish>
> > > >
> > > > doesn't publish the util-3.0.5-sources.jar from my util project.
> > > >
> > > > Also, is there any reference for the [] variables? I thought (from
> > > > looking at my IvyDE configuration) that perhaps the following could
> > work
> > > >
> > > >             ...
> > > >             <artifacts
> > > > pattern="${target.dir}/[artifact]-[revision][source].[ext]" />
> > > >             ...
> > > >
> > > > or
> > > >             ...
> > > >             <artifacts
> > > > pattern="${target.dir}/[artifact]-[revision]-[source].[ext]" />
> > > >             ...
> > > > ?
> > > >
> > > > Any help is greatly appreciated!
> > > >
> > > > Thanks,
> > > > Eric
> > > >
> >
>
>
>
> --
> Xavier Hanin - Independent Java Consultant
> BordeauxJUG co leader - http://www.bordeauxjug.org/
> Blogger - http://xhab.blogspot.com/
> Apache Ivy Creator - http://ant.apache.org/ivy/

Re: How to publish source JAR?

Posted by Xavier Hanin <xa...@gmail.com>.
On Mon, Sep 15, 2008 at 3:57 PM, Seaborne, Andy <an...@hp.com>wrote:

> Adrian,
>
> Thanks for pointing that out.  I've been trying to achieve much the same as
> Eric has and I now have this form working.
>
>
> What I'd really like though is to make the sources result look like
> "acme-9.8.7-sources.jar" and have not found a way to do that because the
> artifact name is split.


You can use an extra attribute for this, as Ivy does for maven 2 artifacts
which look exactly as you want. In m2 they call this a classifier, so your
pattern could be [artifact]-[revision](-[classifier]).[ext]

Xavier


>
>
> Anyone got any ideas for this? (hopefully, I'm just missing something
> obvious ...)
>
>        Andy
>
> > -----Original Message-----
> > From: Adrian Woodhead [mailto:adrian@last.fm]
> > Sent: 9 September 2008 14:51
> > To: ivy-user@ant.apache.org
> > Subject: Re: How to publish source JAR?
> >
> > Well, assuming your build creates two jar files, say acme.jar and
> > acme-source.jar I would do the following...
> >
> > In ivy.xml add two publications:
> >
> >   <publications>
> >     <artifact name="acme" ext="jar"/>
> >     <artifact name="acme-source" ext="jar"/>
> >   </publications>
> >
> > Then your publish target should have one pattern like so:
> >
> > pattern="${target.dir}/[artifact]-[revision].[ext]" />
> >
> >
> > and that should publish both jar files. What you tried to do with having
> > two "artifacts" patterns within publish doesn't work as Ivy only uses
> > the first pattern and ignores the other one.
> >
> > Let us know if that works for you.
> >
> > Regards,
> >
> > Adrian
> >
> > Lewis, Eric wrote:
> > > Newbie is back  :-)
> > >
> > > Somehow I don't get it: How can I publish my JAR with the source files?
> > > From what I understand, I can publish my JAR locally, by using
> > >
> > >         <ivy:publish resolver="local" overwrite="true"
> > > pubrevision="${project.version}">
> > >             <artifacts
> > > pattern="${target.dir}/[artifact]-[revision].[ext]" />
> > >         </ivy:publish>
> > >
> > > This works fine, but I also want to publish my source JAR. But
> > >
> > >         <ivy:publish resolver="local" overwrite="true"
> > > pubrevision="${project.version}">
> > >             <artifacts
> > > pattern="${target.dir}/[artifact]-[revision].[ext]" />
> > >             <artifacts
> > > pattern="${target.dir}/[artifact]-[revision]-sources.[ext]" />
> > >         </ivy:publish>
> > >
> > > doesn't publish the util-3.0.5-sources.jar from my util project.
> > >
> > > Also, is there any reference for the [] variables? I thought (from
> > > looking at my IvyDE configuration) that perhaps the following could
> work
> > >
> > >             ...
> > >             <artifacts
> > > pattern="${target.dir}/[artifact]-[revision][source].[ext]" />
> > >             ...
> > >
> > > or
> > >             ...
> > >             <artifacts
> > > pattern="${target.dir}/[artifact]-[revision]-[source].[ext]" />
> > >             ...
> > > ?
> > >
> > > Any help is greatly appreciated!
> > >
> > > Thanks,
> > > Eric
> > >
>



-- 
Xavier Hanin - Independent Java Consultant
BordeauxJUG co leader - http://www.bordeauxjug.org/
Blogger - http://xhab.blogspot.com/
Apache Ivy Creator - http://ant.apache.org/ivy/

RE: How to publish source JAR?

Posted by "Seaborne, Andy" <an...@hp.com>.
Adrian,

Thanks for pointing that out.  I've been trying to achieve much the same as Eric has and I now have this form working.


What I'd really like though is to make the sources result look like "acme-9.8.7-sources.jar" and have not found a way to do that because the artifact name is split.

Anyone got any ideas for this? (hopefully, I'm just missing something obvious ...)

        Andy

> -----Original Message-----
> From: Adrian Woodhead [mailto:adrian@last.fm]
> Sent: 9 September 2008 14:51
> To: ivy-user@ant.apache.org
> Subject: Re: How to publish source JAR?
>
> Well, assuming your build creates two jar files, say acme.jar and
> acme-source.jar I would do the following...
>
> In ivy.xml add two publications:
>
>   <publications>
>     <artifact name="acme" ext="jar"/>
>     <artifact name="acme-source" ext="jar"/>
>   </publications>
>
> Then your publish target should have one pattern like so:
>
> pattern="${target.dir}/[artifact]-[revision].[ext]" />
>
>
> and that should publish both jar files. What you tried to do with having
> two "artifacts" patterns within publish doesn't work as Ivy only uses
> the first pattern and ignores the other one.
>
> Let us know if that works for you.
>
> Regards,
>
> Adrian
>
> Lewis, Eric wrote:
> > Newbie is back  :-)
> >
> > Somehow I don't get it: How can I publish my JAR with the source files?
> > From what I understand, I can publish my JAR locally, by using
> >
> >         <ivy:publish resolver="local" overwrite="true"
> > pubrevision="${project.version}">
> >             <artifacts
> > pattern="${target.dir}/[artifact]-[revision].[ext]" />
> >         </ivy:publish>
> >
> > This works fine, but I also want to publish my source JAR. But
> >
> >         <ivy:publish resolver="local" overwrite="true"
> > pubrevision="${project.version}">
> >             <artifacts
> > pattern="${target.dir}/[artifact]-[revision].[ext]" />
> >             <artifacts
> > pattern="${target.dir}/[artifact]-[revision]-sources.[ext]" />
> >         </ivy:publish>
> >
> > doesn't publish the util-3.0.5-sources.jar from my util project.
> >
> > Also, is there any reference for the [] variables? I thought (from
> > looking at my IvyDE configuration) that perhaps the following could work
> >
> >             ...
> >             <artifacts
> > pattern="${target.dir}/[artifact]-[revision][source].[ext]" />
> >             ...
> >
> > or
> >             ...
> >             <artifacts
> > pattern="${target.dir}/[artifact]-[revision]-[source].[ext]" />
> >             ...
> > ?
> >
> > Any help is greatly appreciated!
> >
> > Thanks,
> > Eric
> >

RE: How to publish source JAR?

Posted by "Becheanu, Daniel" <db...@cars.com>.
Nvm me..
Here is the link for references look at patterns section

http://ant.apache.org/ivy/history/2.0.0-beta2/concept.html

-----Original Message-----
From: Adrian Woodhead [mailto:adrian@last.fm] 
Sent: Tuesday, September 09, 2008 8:51 AM
To: ivy-user@ant.apache.org
Subject: Re: How to publish source JAR?

Well, assuming your build creates two jar files, say acme.jar and 
acme-source.jar I would do the following...

In ivy.xml add two publications:

  <publications>
    <artifact name="acme" ext="jar"/>
    <artifact name="acme-source" ext="jar"/>
  </publications>

Then your publish target should have one pattern like so:

pattern="${target.dir}/[artifact]-[revision].[ext]" />


and that should publish both jar files. What you tried to do with having

two "artifacts" patterns within publish doesn't work as Ivy only uses 
the first pattern and ignores the other one.

Let us know if that works for you.

Regards,

Adrian

Lewis, Eric wrote:
> Newbie is back  :-)
>
> Somehow I don't get it: How can I publish my JAR with the source
files?
> From what I understand, I can publish my JAR locally, by using
>
>         <ivy:publish resolver="local" overwrite="true"
> pubrevision="${project.version}">
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision].[ext]" />
>         </ivy:publish>
>
> This works fine, but I also want to publish my source JAR. But
>
>         <ivy:publish resolver="local" overwrite="true"
> pubrevision="${project.version}">
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision].[ext]" />
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision]-sources.[ext]" />
>         </ivy:publish>
>
> doesn't publish the util-3.0.5-sources.jar from my util project.
>
> Also, is there any reference for the [] variables? I thought (from
> looking at my IvyDE configuration) that perhaps the following could
work
>
>             ...
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision][source].[ext]" />
>             ...
>
> or
>             ...
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision]-[source].[ext]" />
>             ...
> ?
>
> Any help is greatly appreciated!
>
> Thanks,
> Eric
>   

Re: How to publish source JAR?

Posted by Adrian Woodhead <ad...@last.fm>.
Well, assuming your build creates two jar files, say acme.jar and 
acme-source.jar I would do the following...

In ivy.xml add two publications:

  <publications>
    <artifact name="acme" ext="jar"/>
    <artifact name="acme-source" ext="jar"/>
  </publications>

Then your publish target should have one pattern like so:

pattern="${target.dir}/[artifact]-[revision].[ext]" />


and that should publish both jar files. What you tried to do with having 
two "artifacts" patterns within publish doesn't work as Ivy only uses 
the first pattern and ignores the other one.

Let us know if that works for you.

Regards,

Adrian

Lewis, Eric wrote:
> Newbie is back  :-)
>
> Somehow I don't get it: How can I publish my JAR with the source files?
> From what I understand, I can publish my JAR locally, by using
>
>         <ivy:publish resolver="local" overwrite="true"
> pubrevision="${project.version}">
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision].[ext]" />
>         </ivy:publish>
>
> This works fine, but I also want to publish my source JAR. But
>
>         <ivy:publish resolver="local" overwrite="true"
> pubrevision="${project.version}">
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision].[ext]" />
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision]-sources.[ext]" />
>         </ivy:publish>
>
> doesn't publish the util-3.0.5-sources.jar from my util project.
>
> Also, is there any reference for the [] variables? I thought (from
> looking at my IvyDE configuration) that perhaps the following could work
>
>             ...
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision][source].[ext]" />
>             ...
>
> or
>             ...
>             <artifacts
> pattern="${target.dir}/[artifact]-[revision]-[source].[ext]" />
>             ...
> ?
>
> Any help is greatly appreciated!
>
> Thanks,
> Eric
>