> -----Original Message-----
> From: Wendy Smoak [mailto:[EMAIL PROTECTED]
==////==
>
> From: "Pilgrim, Peter" <[EMAIL PROTECTED]>
>
> > My question is, how do I tell maven not to going looking remotely
> > for POM XML files for the commercial jars since I installed
> > them locally on my machine?
>
> http://www.mail-archive.com/users%40maven.apache.org/msg26066.html
>
> I've just been creating a pom for them with just the
> group/artifact/version
> and Maven stops complaining.
>
> Should we submit poms for these non-distributable commercial
> libraries, so
> that they're in the repository like the ones for Sun .jars
> (and we can come
> to some agreement on the group/artifact ids?)
==////==
I just created a program to create the local POMs for me in the
m2 repository. But when I run it, and manually rename AUTO-pom to
.pom file, and then re-run ``mvn''.
Guess what? Maven still complains about remote repository. So it
cannot possibly that the ``**/*.pom'' does not exist in the right
place. I created it, so therefore maven should shut the ++++ up(!).
import java.io.*;
/**
* Create missing POM XML descriptions for maven repository
* elements
*
*
* @author Peter Pilgrim, Oct 24, 2005 2:43:57 PM
* @version $Id$
*/
public class MvnCreateLocalPom {
private static String repositoryPath =
System.getProperty("user.home")+"/.m2/repository";
/**
* Default constructor
*/
public MvnCreateLocalPom() {
super();
}
/**
* Write the POM to standard output
* @param groupId the group name
*
* @see #dumpPom(String, String)
*/
public void dumpPom( String groupId ) throws IOException
{
File groupDir = new File( repositoryPath +"/" +groupId );
if ( !groupDir.exists() )
throw new FileNotFoundException(
"no such group directory = "+groupDir );
File contents[] = groupDir.listFiles();
for ( int j=0; j<contents.length; ++j ) {
String oneFile = contents[j].getName();
if ( oneFile.equals(".") ||
oneFile.equals("..") )
continue;
// System.out.println( oneFile+" file "+( contents[j].exists() ?
"exists" : "not file"));
dumpPom( groupId, oneFile );
}
}
/**
* Write the POM to standard output
* @param groupId the group name
* @param artifactId the artifact name
*/
public void dumpPom( String groupId, String artifactId ) throws IOException
{
File groupArtifactDir = new File(
repositoryPath +"/" +groupId+"/"+artifactId );
if ( !groupArtifactDir.exists() )
throw new FileNotFoundException(
"no such group artifact directory = "+groupArtifactDir );
File contents[] = groupArtifactDir.listFiles();
for ( int j=0; j<contents.length; ++j ) {
String oneFile = contents[j].getName();
if ( oneFile.equals(".") ||
oneFile.equals("..") )
continue;
// System.out.println( oneFile+" file "+( contents[j].exists() ?
"exists" : "not file"));
if ( contents[j].isDirectory() &&
!oneFile.equals("maven-metadata-local.xml") ) {
// We could have a better stringent test here.
File outputFile = new File(
repositoryPath +"/" +groupId+"/"+artifactId +"/"+
oneFile+"/"+
artifactId+"."+oneFile+".AUTO-pom" );
// Here oneFile should be version identifier number!
FileWriter fwriter = new FileWriter( outputFile );
PrintWriter pwriter = new PrintWriter( fwriter );
pwriter.println("<project>");
pwriter.println(" <modelVersion>4.0.0</modelVersion>");
pwriter.println(" <groupId>"+groupId+"</groupId>");
pwriter.println(" <artifactId>"+artifactId+"</artifactId>");
pwriter.println(" <version>"+oneFile+"</version>");
pwriter.println("</project>");
pwriter.close();
}
}
}
public static void main( String args[] )
{
MvnCreateLocalPom pommer = new MvnCreateLocalPom();
try {
pommer.dumpPom( "commons-beanutils", "commons-beanutils");
pommer.dumpPom( "expresso");
pommer.dumpPom( "bea-weblogic", "weblogic");
}
catch (Exception ex) {
ex.printStackTrace( System.err );
}
}
}
--
Peter Pilgrim :: J2EE Software Development
Operations/IT - Credit Suisse First Boston,
Floor 15, 5 Canada Square, London E14 4QJ, United Kingdom
Tel: +44-(0)207-883-4497
==============================================================================
Please access the attached hyperlink for an important electronic communications
disclaimer:
http://www.csfb.com/legal_terms/disclaimer_external_email.shtml
==============================================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]