On Mar 29, 2007, at 6:39 AM, Filip Hanik - Dev Lists wrote:
Hrm... I'm not sure there exists such a command at the moment, though its probably easy enough to craft a simple goal to implement what you need.
yeah, I might just implement this in ANT all together, and skip maven, if it is a simple SCP copy.

You could do that, though IMO it would be a little better to just get the Maven antlib tasks fixed to allow you to attach artifacts... which I believe other projects will also need.


The reason it doesn't work asis, is that the gpg .asc stuff is attached to the current projects artifact and the install/deploy will handle the primary artifact and then any attached artifacts separately. The install-file/deploy-file goals don't have a project to work on so there is nothing to attach to.

I suppose that either install-file/deploy-file need to take an additional csv list of other files to "attach" or perhaps simply craft a pom.xml which uses build-helper:attach-artifact ( http:// mojo.codehaus.org/build-helper-maven-plugin/attach-artifact- mojo.html ) and dance around mvn a little to make `mvn deploy` work.

But, it would really be better IMO, to use the <deploy> task and update the task to have a nested set of <attached-file> elements which can be used to effectively behave the same as mvn would normally by deploying the primary artifact, and then any attached artifacts. Thats *much* less of a hack.

Can you tell me why the antlib tasks aren't working for you?
there were a few things
1. documentation or my inability to work with it

I understand what you mean... the docs are a bit hard to grok. Would have been nice to see docs in the same style as the Ant manual.


2. learning curve, I'm trying to do something really simple

Its relatively simply, though there are a few wrinkles.

First you need to make sure that the wagon provider that you are using is installed. For example, the Codehaus uses webdav, so for projects there they need to:

<artifact:install-provider artifactId="wagon-webdav" version="1.0-beta-2"/>

But, for ASF projects you probably just want the ssh impl:

<artifact:install-provider artifactId="wagon-ssh" version="1.0- beta-2"/>

Or perhaps the ssh-external version:

<artifact:install-provider artifactId="wagon-ssh-external" version="1.0-beta-2"/>

I would recommend using "wagon-ssh" if you can so you don't have to worry about having any specific native executables on your path/etc.

Then you need to configure the authentication in ~/.m2/settings.xml, which is the same which is used by Maven. If you follow the same server id's as the ASF pom does then somehing like:

----8<----
<?xml version="1.0"?>
<settings>
    <servers>
        <server>
            <id>apache.snapshots</id>
            <username>YOUR_USERNAME</username>
            <directoryPermissions>775</directoryPermissions>
            <filePermissions>664</filePermissions>
        </server>

        <server>
            <id>apache.releases</id>
            <username>YOUR_USERNAME</username>
            <directoryPermissions>775</directoryPermissions>
            <filePermissions>664</filePermissions>
        </server>
    </servers>
</settings>
---->8----

Obviously changing YOUR_USERNAME with what is appropriate for your account on people.apache.org. You will probably need to configure either a <password> or a <passphrase> for each of the server's depending on how you have configured access via SSH.

And then you need pom's for each of your artifacts, and in those poms you should include a <distributionManagement> section to configure where to deploy to, like:

----8<----
    <distributionManagement>
        <repository>
            <id>apache.releases</id>
            <name>Apache Release Distribution Repository</name>
<url>scp://people.apache.org/www/people.apache.org/repo/ m2-ibiblio-rsync-repository</url>
        </repository>
        <snapshotRepository>
            <id>apache.snapshots</id>
            <name>Apache Development Snapshot Repository</name>
<url>scp://people.apache.org/www/people.apache.org/repo/ m2-snapshot-repository</url>
        </snapshotRepository>
    </distributionManagement>
---->8----

I'm not 100% sure, but the Maven antlib tasks _might_ use the normal parent pom inclusion bits, in which case all you need to do is make sure that your top-level pom uses the ASF pom as its parent:

----8<----
    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>4</version>
    </parent>
---->8----

This should get the default <distributionManagement> configuration into your poms.

And then you just need to <artifact:deploy> with a reference to the artifact's file and its pom. The artifact will be deployed with the version information in the referenced pom and will be deployed to either the <repository> or <snapshotRepository> as configured in the poms <distributionManagement>.


3. SCP with maven on windows simply didn't work, turns out that it still doesn't work when using the command line arguments, so I am still running from linux.

Weird... not sure that is related to Maven :-P What didn't work, did it spit out any errors? It *should* work if things are configured properly.


since all I wanna do is SCP a .jar .pom .md5 and .asc, why does this have to be so complicated :)

Well, its not all that complicated :-P It just requires a wee bit of configuration to make it work. For most Maven projects this just one of those things you have to do (configure the wagon impl, setup the distributionManagement, etc... though much of that can be done once and then simply inherited. The trickiest part IMO (maven or ant) is making sure you setup ~/.m2/settings.xml. This is generally a one time thing for each user... just set it up once and forget about it.

I'm not sure that doing this directly with Ant would be any less complex. You still need to add stuff to configure where stuff goes, and then tasks to make it go there, and then abstract the user authentication bits... so its about the same amount of work.


if I can reverse engineer what it is Maven is doing when publishing a file to a repo, it will be easier for me to implement it in pure ant.

Yup you could... though chances are you will find that a wee bit frustrating, since its all componentized over several different projects.

IMO, you are better off using the Maven antlib tasks. I just cracked open the src of these puppies and it looks like it should be simple to add some additional configuration for attached artifacts. Then you would just have to create the .asc for each artifact, then something like:

    <artifact:deploy file="somefile.jar" pom="somefile.pom">
        <attach file="somefile.jar.asc"/>
        <attach file="somefile.pom.asc"/>
    </artifact:deploy>

They are going to be releasing a new set of tasks soon to sync up with the latest Maven 2.0.6 release. The code to add support for attaching files is trivial, so I'm going to patch it and hopefully this will get into the release next week.

--jason

Reply via email to