You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dave Syer <da...@hotmail.com> on 2006/08/08 09:46:57 UTC

Automating install:install-file

I have seen a lot of posts asking about how to install jar files in the local
repo, and install:install-file works fine, but I can't find a way of
automating it.  All the docs and the posts talk about manually installing
3rd party jars when they are needed.  My goal is to have a project in source
control that anybody can checkout and run a single mvn goal, resulting in N
jar files in the local mvn repository.

I have tried configuring a pom with install-file as an execution in the
install cycle, e.g.

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-install-plugin</artifactId>
      <configuration>
        <file>...</file>
        <groupId>...</groupId>
        <artifactId>...</artifactId>
        <version>...</version>
      </configuration>
    <plugin>
  </plugins>
</build>

Is this so crazy?  The plugin barfs with a message about "Cannot override
read-only parameter:".  It seems I cannot use install-file except on the
command line.  Have I missed something obvious?  Is there a better way to do
this?


-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5701835
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Automating install:install-file

Posted by Gareth Tilley <ga...@rmb.co.za>.
Apologies, I misread your post.
-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5702236
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Automating install:install-file

Posted by Dave Syer <da...@hotmail.com>.
> From ... "copies the final package to the remote repository for sharing
> with other developers and projects" meaning the package (artifact) of a
> project

That's fine.  I would *love* to be able to make the artifact of a project an
existing jar file.  Instead I have to struggle with tricking maven into
thinking that it has built a jar file when it hasn't.  All I want is these
3rd party jars in a repo somewhere with a proper pom...

> You can specify a pom with either install:install-file or
> deploy:deploy-file. Check their mojo documentation. The difference is
> that with install:install-file, generatePom defaults to false whereas
> with deploy:deploy-file, it defaults to true. 

...which means, not the pom that is autogenerated by deploy-file or
install-file - deploy-file allows me to specify a concrete pom.

I don't feel like I'm getting any further forward here.  Maven is not the
only game in town, and there will always be jar files that other people
produce.  It just isn't very easy to use them in a controlled environment,
within the maven framework.  OK I can write scripts, but the point is that I
want maven to do my build, and not to have to rely on other tools (that
might not be available according to the platform).
-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5730267
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Automating install:install-file

Posted by Dave Syer <da...@hotmail.com>.
> It sounds to me like you're using the deploy:deploy-file goal
> incorrectly.

I'm trying to use it differently, not incorrectly.  I don't want to write a
DOS .bat script to do this because it won't work on a UN*X system.  The idea
is that I should be able to run "mvn deploy" from my project root (or the
parent project if there are multiple dependencies), and have the jar
deployed.  I'd be happy with "mvn install" and have the jar installed
locally, but that was an even less productive avenue.  Although, actually
now I am more keen to get a proper pom in my repo, so deploy looks like the
way to go because I can add a pom with the pomFile parameter.

This is all very frustrating, I must say.  I have spent close to three days
now trying to build an existing project that was already building fine with
ant.  I still believe there is some mileage in it, bbut I'm running out of
patience.
-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5726808
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Automating install:install-file

Posted by Dave Syer <da...@hotmail.com>.
> I would disagree that this is somehow harder than what you're talking
> about. 

You are correct, it is at least equally hard.  However I have made some
progress though with the deploy plugin.  It seems there is some duplication
of effort between deploy:deploy-file and install:install-file.  Also the
former is more robust and has a richer configuration, so it was good advice
to use it.  The docos for wagon are pitifully bad (possibly because of a bug
in the site generation), but I managed to piece it together.

The short story is: if you use <url>file://<path-to-my-local-repo></url> in
the configuration for deploy-file it works pretty much the same as
install-file.  This is fine by me, and I can switch to ftp or scp if I ever
need to (and can find some decent documentation).

One last question: how do I switch off the default behaviour of "mvn
deploy"?  I want to only run the deploy:deploy-file goal in the deploy
phase, and not try to deploy my empty pom with no artifacts (which I am
using to configure the deploy-file).  Is there a <packaging>none</packaging>
or something in the distributionManagement section of the pom I can use?

> And aren't you going to want an internal repo at some point
> anyway?

Maybe, but that doesn't mean it's going to be easy to get control of ftp or
shared filesystem permissions.  I only wanted to be able to test the
deployment before going through the pain of setting up an internal repo.

> Although I'm sure the install plugin could be modified to not 
> have the read-only params

Actually it already has been modified, but not yet published (see earlier
post).  Presumably the deploy plugin never had this restriction.
-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5721358
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Automating install:install-file

Posted by Dave Syer <da...@hotmail.com>.
> Why not just set up an internal repository to contain these jars and use
> deploy:deploy-file one time to put them there? 

I might end up there anyway, but that seems like the hard way.  I would need
access to a web/ftp server and the ability / permission to upload files
there?  Is there no way I can do it with just a normal source control
system?
-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5708666
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Automating install:install-file

Posted by Dave Syer <da...@hotmail.com>.
I agree - this is less than completely satisfactory.  If I'm force to
manually install everything, I can't use maven to manage the dependencies
for me.  Can anyone offer any insight into why the parameters in
install-file are readonly?

There is actually an issue logged [MINSTALL-12] about this, which says it is
fixed (several months ago).  The repo shows that the source code was
updated, but I still get  the same problem.  What am I doing wrong (using
maven 2.0.4)?
-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5704707
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Automating install:install-file

Posted by Denis Cabasson <de...@insee.fr>.
I have already encountered your porblem, and the only solution I have found
so far is having a ant build setting every needed jar in place. This ant
script can be called from the maven build (via the antrun plugin).

While this is not a completly satisfying solution, I have found no other
solution so far....

Denis.

Dave Syer wrote:
> 
> That's not the case (and I wouldn't bother posting to a forum if all I
> needed to do was build my own jar files and install them).  I am talking
> about large numbers of precompiled, prepackaged third party jars.
> 

-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5702161
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Automating install:install-file

Posted by Dave Syer <da...@hotmail.com>.
That's not the case (and I wouldn't bother posting to a forum if all I needed
to do was build my own jar files and install them).  I am talking about
large numbers of precompiled, prepackaged third party jars.
-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5702080
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Automating install:install-file

Posted by Gareth Tilley <ga...@rmb.co.za>.
If you're just trying to install your own project to the repository you can
just run 'mvn install'.
-- 
View this message in context: http://www.nabble.com/Automating-install%3Ainstall-file-tf2071058.html#a5701936
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org