maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Graham <chrisgw...@gmail.com>
Subject Re: Can I create folder Dependency?
Date Wed, 04 Sep 2013 09:49:08 GMT
I use this, make-maven-files.sh to build a runtime-library.pom file, which
is a consolidation pom of all jars within the folder from which it is run.

#!/bin/bash

# All you need to do is:
# 1. Edit the values below.
# 2. Copy this script into the dir with the jars in it (no nested dirs)
# 3. Run make-maven-files.sh.
# 4. Execute either maven-install.sh and/or maven-deploy.sh that were
generated by make-maven-files.sh
#
# Chris Graham - ChrisGWarp@gmail.com
#

groupId=com.ibm.ram
version=7.5.1.2
repositoryId=project.repo.id
repositoryURL=http://maven.repo.server/url

#example
# repositoryId=warpspeed.non.freeware
# repositoryURL=
http://archiva.warpspeed.com.au/archiva/repository/warpspeed.non.freeware

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > runtime-library.pom
echo "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"
http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">"
>> runtime-library.pom
echo "    <modelVersion>4.0.0</modelVersion>" >> runtime-library.pom
echo "    <groupId>$groupId</groupId>" >> runtime-library.pom
echo "    <artifactId>runtime-library</artifactId>" >> runtime-library.pom
echo "    <version>$version</version>" >> runtime-library.pom
echo "    <packaging>pom</packaging>" >> runtime-library.pom
echo "    <description>Library POM for the $groupId v$version
runtime.</description>" >> runtime-library.pom
echo "    <dependencies>" >> runtime-library.pom

echo "#!/bin/bash" > maven-install.sh
echo "mvn install:install-file -Dfile=runtime-library.pom
-DpomFile=runtime-library.pom" >> maven-install.sh

echo "#!/bin/bash" > maven-deploy.sh
echo "mvn deploy:deploy-file -Dfile=runtime-library.pom
-DpomFile=runtime-library.pom -DrepositoryId=$repositoryId
-Durl=$repositoryURL" >> maven-deploy.sh

find . -name "*.jar" | sort -u | sed "s/^.*\///" | while read jar
do
  artifactId=`echo $jar | sed 's/.jar//'`

  echo "mvn install:install-file -Dfile=$jar -DgroupId=$groupId
-DartifactId=$artifactId -Dversion=$version -DgeneratePom=true
-Dpackaging=jar -DcreateChecksum=true" >> maven-install.sh

  echo "mvn deploy:deploy-file -Dfile=$jar -DgroupId=$groupId
-DartifactId=$artifactId -Dversion=$version -DgeneratePom=true
-Dpackaging=jar -DcreateChecksum=true -DrepositoryId=$repositoryId
-Durl=$repositoryURL" >> maven-deploy.sh

  echo "        <dependency>" >> runtime-library.pom
  echo "            <groupId>$groupId</groupId>" >> runtime-library.pom
  echo "            <artifactId>$artifactId</artifactId>" >>
runtime-library.pom
  echo "            <version>$version</version>" >> runtime-library.pom
  echo "        </dependency>" >> runtime-library.pom

done

echo "    </dependencies>" >> runtime-library.pom
echo "</project>" >> runtime-library.pom

echo "Done."



On Wed, Sep 4, 2013 at 1:32 PM, Wayne Fay <waynefay@gmail.com> wrote:

> > I am new for Maven; I have a question:
>
> Questions like this should go to the Maven Users list. This list is
> reserved for discussion of the development of Maven itself.
>
> > Can I create folder Dependency in Maven? without installing the jar
> > (dependency)?
>
> No. You will waste a lot of time going down this road. You only need
> to install "all" those jars one time (assuming you have a Repo
> Manager, you'll use "mvn deploy:deploy-file" otherwise you'll need to
> "mvn install:install-file" them on each developer's machine) and write
> the <dependency> stanzas once. Then you can reuse that work in your
> various projects. Bite the bullet and do it now. 100 jars is not too
> bad. If you do it the right way, I bet you'll find a lot of them are
> open source and already hosted in Central.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message