hi, Could you please point me to existent ant / maven file (or hint the
other solution), that  helps install a great amount of ordinary jar files
into local maven repository.

Basically, I'm going to reorganize my projects with maven principles and
tool, so I need to install into repository all currently used thirty-part
jars (that have the commercial  nature and have not  been exposed into
private or public repository yet). There are a lot of them  so I can't
neither to invoke the command for ones that have no dependencies
mvn deploy:deploy-file -DgroupId=FIXED_CORPORATE_ID
-DartifactId=NAMEOFJAR_VARIED -Dversion=2.6 -Dpackaging=jar
-Dfile=NAMEOFJAR_VARIED.jar -Durl=file:\\c:\usr\local\.m2\local-repository
nor to provide an POM file when some has dependencies declared  in
MANIFEST/classpath

I'd tried to write the ant script that do this (with no manifest analyzing),
but have problem, that property 'mt.filename' below has not been resolved in
runtime

<?xml version="1.0" encoding="UTF-8"?>
<project name="Migration Tool" default="install" basedir=".">
    <description>Install plain jar files into maven repository with
specified metadata</description>

    <taskdef resource="net/sf/antcontrib/antlib.xml">
        <classpath>
            <pathelement location="/usr/share/java/lib/ant-contrib-1.0b3.jar"
/>
        </classpath>
    </taskdef>

    <!-- - - - - - - - - - - - - - - - - -
            properties: maven properties
           - - - - - - - - - - - - - - - - - -->

    <property name="mt.maven-repository.url"
value="file:\\c:\usr\local\.m2\local-repository" />
    <property name="mt.maven.home" value="/bin/build-tools/apache-
maven-2.0.8/bin" />
    <property name="mt.maven.bin" value="mvn.bat" />
    <property name="mt.groupId" value="corporategroupid" /> <!-- fixed for
all-->
    <property name="mt.version" value="3.0.1" /> <!-- fixed for all-->

    <!-- =================================
          target: install
         ================================= -->
    <target name="install"   description="install file into repository">
        <for param="file">
            <path>
                <fileset dir=".">
                    <filename name="*.jar" />
                </fileset>
            </path>
            <sequential>
                <!-- deploy -->
                <propertyregex override="yes" property="mt.filename"
input="@{file}" regexp=".*/([^\.]*)\.jar" replace="\1" />
                <echo>@{file}</echo>
                <echo>${mt.filename}</echo>
                <exec executable="${mt.maven.home}/${mt.maven.bin}">
                    <arg value="deploy:deploy-file" />
                    <arg value="-DgroupId=${mt.groupId}" />
                    <arg value="-DartifactId=${mt.filename}" />
                    <arg value="-Dversion=${mt.version}" />
                    <arg value="-Dpackaging=jar" />
                    <arg value="[EMAIL PROTECTED]" />
                    <arg value="-Durl=${mt.maven-repository.url}" />
                </exec>
                <!-- deploy:deploy-file -DgroupId=${mt.groupId}
-DartifactId=LocalNameOfFileWithNoExtension -Dversion=${mt.version}
-Dpackaging=jar -Dfile=LocalNameOfFile.jar -Durl=${mt.maven-repository.url}
-->
            </sequential>
        </for>

    </target>



</project>

so it lists the @{file} as absolute path, when ${mt.filename} remains '${
mt.filename}' (unresolved). I can't just pass @{file} to maven args, since
 it complains on the long (absolute) path into arguments (reported: Missing
group,  artifact, version or packaging information).
Probably using ant-maven task (install-file) has the same limitation, since
i need to iterate over a file list and provide short file names to maven.
The first question is if anyone know the resolution.


The next question is if anyone know the simple approach (extension) to
extract class-path entry from manifest and put them as args for on-fly
created dependencies (with no predefined pom)?

ant -version  = 1.7.0
mvn --version = 2.0.8
java -version = 1.5.0_07
OS = win xp


-- 
Best regards,
~ Xasima ~

Reply via email to