Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1464 - in development/laboratory/maven/magic-migrate: . src/conf src/main/net/dpml/magic/maven/migrate src/test/net/dpml/magic/maven/migrate

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mraad23 AT earthlink.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1464 - in development/laboratory/maven/magic-migrate: . src/conf src/main/net/dpml/magic/maven/migrate src/test/net/dpml/magic/maven/migrate
  • Date: Wed, 12 Jan 2005 02:29:54 +0100

Author: mraad23 AT earthlink.net
Date: Wed Jan 12 02:29:54 2005
New Revision: 1464

Removed:
development/laboratory/maven/magic-migrate/src/conf/defaults.properties
development/laboratory/maven/magic-migrate/src/conf/driver.properties
development/laboratory/maven/magic-migrate/src/conf/log4j.properties
Modified:
development/laboratory/maven/magic-migrate/plugin.jelly
development/laboratory/maven/magic-migrate/plugin.properties
development/laboratory/maven/magic-migrate/project.xml

development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/FileExistsException.java

development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java

development/laboratory/maven/magic-migrate/src/test/net/dpml/magic/maven/migrate/MigateTest.java
Log:
Moved conf file into src/main to be more magic compliant.
Adjusted FileExistsException to take the filename that exists.
Added javadoc.


Modified: development/laboratory/maven/magic-migrate/plugin.jelly
==============================================================================
--- development/laboratory/maven/magic-migrate/plugin.jelly (original)
+++ development/laboratory/maven/magic-migrate/plugin.jelly Wed Jan 12
02:29:54 2005
@@ -19,60 +19,60 @@
-->

<project xmlns:j="jelly:core"
- xmlns:util="jelly:util"
- xmlns:ant="jelly:ant" >
+ xmlns:util="jelly:util"
+ xmlns:ant="jelly:ant">

- <goal name="magic" prereqs="magic:migrate" description="Migrate the Maven
projects to Magic."/>
-
- <!-- Creates the structure in DPML_HOME.
- It then takes the current project and adds it, and its
- dependencies to the first index.xml file found in the
- hierarchy above. If no index.xml is found, it creates a new one
- in the current directory.
- -->
- <goal name="magic:migrate" >
- <attainGoal name="magic:dpml" />
-
- </goal>
-
- <!-- Reads the current directory's project.xml and generates a module.xml
- for Magic, and adds that module.xml as a project in the index.xml
- in current directory. If no index.xml is found, it does nothing.
- -->
- <goal name="magic:module" >
-
- </goal>
-
- <!-- Creates the DPML_HOME structure. -->
- <goal name="magic:dpml">
- <property environment="env"/>
- <j:set var="dpml_home" value="${env.DPML_HOME}"/>
- <j:useBean var="migrate" class="net.dpml.magic.maven.migrate.Migrate"/>
- ${migrate.createDpml( pom, dpml_home )}
- </goal>
-
-
- <!-- Migrates all found POMs in the directories below, into Magic index.xml
- file.
- -->
- <goal name="magic:migrate">
- <property environment="env"/>
- <j:set var="dpml_home" value="${env.DPML_HOME}"/>
- <j:useBean var="migrate" class="net.dpml.magic.maven.migrate.Migrate"/>
- ${migrate.migrate( pom, dpml_home )}
- </goal>
-
- <!-- Creates the standard build.xml files in the directories below the
current
- directory. If the directory contains a src/ dir, thr standard template
- is created, otherwise the reactor template is created. If the
- standard template is created, no further transversing of directory
- structure will occur.
- -->
- <goal name="magic:create-build">
- <property environment="env"/>
- <j:set var="dpml_home" value="${env.DPML_HOME}"/>
- <j:useBean var="migrate" class="net.dpml.magic.maven.migrate.Migrate"/>
+ <goal name="magic" prereqs="magic:migrate" description="Migrate the
Maven projects to Magic."/>
+
+ <!-- Creates the structure in DPML_HOME.
+ It then takes the current project and adds it, and its
+ dependencies to the first index.xml file found in the
+ hierarchy above. If no index.xml is found, it creates a new one
+ in the current directory.
+ -->
+ <goal name="magic:migrate">
+ <attainGoal name="magic:dpml"/>
+
+ </goal>
+
+ <!-- Reads the current directory's project.xml and generates a module.xml
+ for Magic, and adds that module.xml as a project in the index.xml
+ in current directory. If no index.xml is found, it does nothing.
+ -->
+ <goal name="magic:module">
+
+ </goal>
+
+ <!-- Creates the DPML_HOME structure. -->
+ <goal name="magic:dpml" description="Create the DPML_HOME directory
structure.">
+ <property environment="env"/>
+ <j:set var="dpml_home" value="${env.DPML_HOME}"/>
+ <j:useBean var="migrate"
class="net.dpml.magic.maven.migrate.Migrate"/>
+ ${migrate.createDpml( pom, dpml_home )}
+ </goal>
+
+
+ <!-- Migrates all found POMs in the directories below, into Magic
index.xml
+ file.
+ -->
+ <goal name="magic:migrate">
+ <property environment="env"/>
+ <j:set var="dpml_home" value="${env.DPML_HOME}"/>
+ <j:useBean var="migrate"
class="net.dpml.magic.maven.migrate.Migrate"/>
+ ${migrate.migrate( pom, dpml_home )}
+ </goal>
+
+ <!-- Creates the standard build.xml files in the directories below the
current
+ directory. If the directory contains a src/ dir, thr standard
template
+ is created, otherwise the reactor template is created. If the
+ standard template is created, no further transversing of directory
+ structure will occur.
+ -->
+ <goal name="magic:create-build">
+ <property environment="env"/>
+ <j:set var="dpml_home" value="${env.DPML_HOME}"/>
+ <j:useBean var="migrate"
class="net.dpml.magic.maven.migrate.Migrate"/>
${migrate.createBuilds( pom, dpml_home )}
- </goal>
-
+ </goal>
+
</project>

Modified: development/laboratory/maven/magic-migrate/plugin.properties
==============================================================================
--- development/laboratory/maven/magic-migrate/plugin.properties
(original)
+++ development/laboratory/maven/magic-migrate/plugin.properties Wed
Jan 12 02:29:54 2005
@@ -1,3 +1,4 @@
+#
# Copyright 2004 Stephen J McConnell
# Copyright 2004 Niclas Hedhman
#

Modified: development/laboratory/maven/magic-migrate/project.xml
==============================================================================
--- development/laboratory/maven/magic-migrate/project.xml (original)
+++ development/laboratory/maven/magic-migrate/project.xml Wed Jan 12
02:29:54 2005
@@ -426,7 +426,7 @@
</includes>
</resource>
<resource>
- <directory>${basedir}/src/conf</directory>
+ <directory>${basedir}/src/main</directory>
<includes>
<include>*.properties</include>
</includes>

Modified:
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/FileExistsException.java
==============================================================================
---
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/FileExistsException.java
(original)
+++
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/FileExistsException.java
Wed Jan 12 02:29:54 2005
@@ -20,7 +20,6 @@
package net.dpml.magic.maven.migrate;

import java.io.IOException;
-import java.io.File;

/**
* Exception to be thrown when a file already exists.
@@ -31,25 +30,19 @@
extends IOException
{
/**
- * The existing file.
+ * Create a new instance.
*/
- private File m_file;
-
- /**
- * Create a instance with a reference to the existing file.
- *
- * @param file the existing file.
- */
- public FileExistsException( File file )
+ public FileExistsException()
{
- m_file = file;
}

/**
- * @return the file that already exists.
+ * Create a new instance with the name of the file as the message..
+ *
+ * @param filename the name of the file.
*/
- public File getFile()
+ public FileExistsException( String filename )
{
- return m_file;
+ super( filename );
}
}

Modified:
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java
==============================================================================
---
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java
(original)
+++
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java
Wed Jan 12 02:29:54 2005
@@ -21,6 +21,8 @@

import org.apache.maven.project.Project;
import org.apache.maven.project.Dependency;
+import org.apache.maven.project.Build;
+import org.apache.maven.project.Resource;
import org.apache.maven.MavenException;
import org.apache.maven.MavenUtils;
import org.dom4j.Document;
@@ -35,12 +37,11 @@
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
-
+import java.util.List;

/**
- * TODO Create a map of the version numbers.
+ * Class to be instantiated by the jelly plugin to migrate maven projects to
magic.
*/
-
public class Migrate
{
/**
@@ -48,15 +49,38 @@
*/
private static final int INITIAL_SIZE = 500;

- public void migrate( Project proj,
- String dpml )
+ /**
+ * Migrate current project.
+ *
+ * @param project the maven project. this reference is passed by jelly
script.
+ * @param dpml the value of DMPL_HOME environment variable.
+ */
+ public void migrate(
+ Project project,
+ String dpml
+ )
{
}

- public void createDpml( Project proj,
- String dpml )
+ /**
+ * Create DPML directory structure in DPML_HOME environemt variable.
+ * This method is called by the jelly plugin and is supplied a reference
to the
+ * maven project and the value of the DPML_HOME enviroment variable.
+ * If DPML_HOME is not defined, then the DPML structure will be created
+ * in the user's home directory under ~/.dpml.
+ * The following directories will be created: bin, transit/authority,
cache and docs.
+ *
+ * @param project the maven project.
+ * @param dpml the value of DMPL_HOME environment variable.
+ * This value can be null indicating the creation of the
structure
+ * in the user's home directory.
+ */
+ public void createDpml(
+ Project project,
+ String dpml
+ )
{
- System.out.println( "Project:" + proj.getName() );
+ System.out.println( "Project:" + project.getName() );
System.out.println( "DPML_HOME=" + dpml );
if( dpml == null )
{
@@ -72,39 +96,35 @@
File transitdir = new File( dpmlHome, "transit/authority" );
transitdir.mkdirs();

- File cachedir = new File( dpmlHome, "main" );
+ File cachedir = new File( dpmlHome, "cache" );
cachedir.mkdirs();

File docsdir = new File( dpmlHome, "docs" );
docsdir.mkdirs();

- String magicPath = proj.getDependencyPath( "dpml-magic" );
+ String magicPath = project.getDependencyPath( "dpml-magic" );
System.out.println( "Magic path=" + magicPath );

- String transitPath = proj.getDependencyPath( "dpml-transit" );
+ String transitPath = project.getDependencyPath( "dpml-transit" );
System.out.println( "Transit path=" + transitPath );
-
-
- }
-
- public void createBuilds( Project proj,
- String dpml )
- throws IOException, MavenException
- {
- File cwd = new File( "." );
- processDir( cwd );
}

/**
- * Create build and index file recursuvely from the given base dir.
+ * Create build.xml and index.xml recusuvely from the current directory.
*
- * @param basedir the base directory.
- * @throws IOException if and IO error occured.
+ * @param project the maven project.
+ * @param dpml the value of DPML_HOME environment variable.
+ * @throws IOException if an IO error occured.
* @throws MavenException if a maven error occured.
*/
- public void createBuilds( File basedir ) throws IOException,
MavenException
+ public void createBuilds(
+ Project project,
+ String dpml
+ )
+ throws IOException, MavenException
{
- processDir( basedir );
+ File cwd = new File( "." );
+ processDir( project, cwd );
}

/**
@@ -112,57 +132,82 @@
* If the current entry contains a project.xml file, then we create a
standard build.xml and an index.xml.
* Otherwise we create a reactor build.xml file and dive into that entry
and repeat the above process.
*
- * @param basedir the base directory.
+ * @param project the maven project.
+ * @param cwd the current working directory.
* @throws IOException if an IO error occured.
* @throws MavenException if a maven error occured.
*/
- private void processDir( File basedir ) throws IOException,
MavenException
+ private void processDir(
+ Project project,
+ File cwd
+ ) throws IOException, MavenException
{
- File[] entries = basedir.listFiles();
- if( isProjectDir( entries ) )
+ if( cwd.isDirectory() )
{
- Project mavenProject = getMavenProject( basedir );
- createStandardBuild( basedir, mavenProject );
- createStandardIndex( basedir, mavenProject );
+ File[] entries = cwd.listFiles();
+ if( isProjectDir( entries ) )
+ {
+ // Create file with parent file, or NPE will be thrown.
+ File mavenFile = new File( cwd.getCanonicalFile(),
"project.xml" );
+ if( mavenFile.exists() )
+ {
+ Project mavenProject = MavenUtils.getProject( mavenFile,
null, false );
+ createStandardBuild( mavenProject, cwd );
+ createStandardIndex( mavenProject, cwd );
+ createModuleFile( mavenProject, cwd );
+ // processResources( mavenProject, cwd );
+ }
+ }
+ else
+ {
+ createReactorBuild( project, cwd );
+ recurse( project, entries );
+ }
}
- else
+ }
+
+ /**
+ * Process resources tags. Magic expect all resources to be placed in the
+ * main directory to be included in the final deliverable.
+ *
+ * @param mavenProject the maven project.
+ * @param cwd the current working directory.
+ */
+ private void processResources(
+ Project mavenProject,
+ File cwd
+ )
+ {
+ final Build build = mavenProject.getBuild();
+ final List resourceList = build.getResources();
+ final int size = resourceList.size();
+ for( int i = 0; i < size; i++ )
{
- createReactorBuild( basedir );
- recurse( entries );
+ final Resource resource = ( Resource ) resourceList.get( i );
+ System.out.println( "resource.getDirectory() = " +
resource.getDirectory() );
+ System.out.println( "resource.getIncludes() = " +
resource.getIncludes() );
}
}

/**
* Create index.xml file.
*
- * @param basedir the base directory.
* @param project the maven project.
+ * @param cwd the current working directory.
* @throws IOException if an IO error occured.
*/
- private void createStandardIndex( File basedir,
- Project project ) throws IOException
+ private void createStandardIndex(
+ Project project,
+ File cwd
+ )
+ throws IOException
{
-
Document document = DocumentHelper.createDocument();
Element index = document.addElement( "index" );
// importMetroModule(index);
createProject( index, project );
- writeIndexDotXml( basedir, document );
- }
-
- /**
- * Read maven project.xml in the base directory.
- *
- * @param basedir the base directory.
- * @return return a maven Project.
- * @throws MavenException if cannot read the project.xml file.
- */
- private Project getMavenProject( File basedir ) throws MavenException,
IOException
- {
- System.out.println( "basedir = " + basedir );
- File mavenFile = new File( basedir.getCanonicalFile(), "project.xml"
); // Create file with parent file, or NPE will be thrown.
- System.out.println( "mavenFile = " + mavenFile );
- return MavenUtils.getProject( mavenFile, null, false );
+ createModule( index, project );
+ writeIndexDotXml( cwd, document );
}

/**
@@ -172,8 +217,11 @@
* @param document the document to write.
* @throws IOException if IO error occured.
*/
- private void writeIndexDotXml( File basedir,
- Document document ) throws IOException
+ private void writeIndexDotXml(
+ File basedir,
+ Document document
+ )
+ throws IOException
{
FileWriter fileWriter = new FileWriter( new File( basedir,
"index.xml" ) );
try
@@ -191,20 +239,43 @@
}

/**
- * Create the project tag.
+ * Create module tag in the index.xml file.
+ *
+ * @param index the index element.
+ * @param project the maven project.
+ */
+ private void createModule(
+ Element index,
+ Project project
+ )
+ {
+ Element projectElement = index.addElement( "project" );
+ projectElement.addAttribute( "file", "module.xml" );
+ Element infoElement = projectElement.addElement( "info" );
+ infoElement.addElement( "group" ).addText( project.getGroupId() );
+ infoElement.addElement( "name" ).addText( project.getArtifactId() );
+ infoElement.addElement( "version" ).addText(
project.getCurrentVersion() );
+ infoElement.addElement( "type", "module" );
+ addDependencies( projectElement, project );
+ }
+
+ /**
+ * Create the project tag in the index.xml file.
*
* @param index the index element.
* @param project the maven project.
*/
- private void createProject( Element index,
- Project project )
+ private void createProject(
+ Element index,
+ Project project
+ )
{
addResources( index, project );
Element projectElement = index.addElement( "project" );
projectElement.addAttribute( "basedir", "." );
Element infoElement = projectElement.addElement( "info" );
infoElement.addElement( "group" ).addText( project.getGroupId() );
- infoElement.addElement( "name" ).addText( project.getName() );
+ infoElement.addElement( "name" ).addText( project.getArtifactId() );
infoElement.addElement( "version" ).addText(
project.getCurrentVersion() );
addDependencies( projectElement, project );
}
@@ -215,8 +286,10 @@
* @param projectElement the project element.
* @param project the maven project.
*/
- private void addDependencies( Element projectElement,
- Project project )
+ private void addDependencies(
+ Element projectElement,
+ Project project
+ )
{
Element dependenciesElement = projectElement.addElement(
"dependencies" );
java.util.List list = project.getDependencies();
@@ -240,8 +313,10 @@
* @param index the index element.
* @param project the maven project.
*/
- private void addResources( Element index,
- Project project )
+ private void addResources(
+ Element index,
+ Project project
+ )
{
java.util.List list = project.getDependencies();
int size = list.size();
@@ -269,94 +344,178 @@
/**
* Recurse over the the given array of files.
*
+ * @param project the maven project.
* @param entries the files to resurse throught.
* @throws IOException if an IO error occured.
* @throws MavenException if a maven error occured.
*/
- private void recurse( File[] entries ) throws IOException, MavenException
+ private void recurse(
+ Project project,
+ File[] entries
+ ) throws IOException, MavenException
{
for( int i = 0; i < entries.length; i++ )
{
- processDir( entries[i] );
+ final File entry = entries[i];
+ if( includeEntry( entry.getName() ) )
+ {
+ processDir( project, entry );
+ }
+ }
+ }
+
+ /**
+ * Check if entry should be included based on its name.
+ * Currently, .csv and .svn are skipped.
+ * TODO create a system property with list of files to skip.
+ *
+ * @param name the name of the entry.
+ * @return true if should be included, false otherwise.
+ */
+ private boolean includeEntry( String name )
+ {
+ boolean include;
+ if( ".csv".equals( name ) )
+ {
+ include = false;
+ }
+ else if( ".svn".equals( name ) )
+ {
+ include = false;
+ }
+ else
+ {
+ include = true;
}
+ return include;
}

/**
* Check if the directory contains a 'src' entry..
*
* @param files array of files.
- * @return true if one of the entries is 'src', false otherwise.
+ * @return true if one of the entries is 'src, false otherwise.
*/
private boolean isProjectDir( File[] files )
{
- boolean foundSrc = false;
- for( int i = 0; i < files.length; i++ )
+ boolean found = false;
+ if( files != null )
{
- if( "src".equals( files[i].getName() ) )
+ for( int i = 0; i < files.length; i++ )
{
- foundSrc = true;
- break;
+ if( "src".equals( files[i].getName() ) )
+ {
+ found = true;
+ break;
+ }
}
}
- return foundSrc;
+ return found;
}

/**
- * Create standard build.xml file.
+ * The content of module.xml.
+ */
+ private static final String MODULE = "<?xml version=\"1.0\"
encoding=\"UTF-8\" ?>\n"
+ + "\n"
+ + "<project name=\"dpml-central\" default=\"install\" basedir=\".\"
\n"
+ + " xmlns:magic=\"antlib:net.dpml.magic\"
xmlns:x=\"plugin:dpml/magic/dpml-magic-core\" >\n"
+ + "\n"
+ + " <magic:import uri=\"artifact:template:dpml/magic/standard\"/>\n"
+ + "\n"
+ + " <target name=\"build\" depends=\"standard.build\">\n"
+ + " <x:module index=\"index.xml\">\n"
+ + " </x:module>\n"
+ + " </target>\n"
+ + "\n"
+ + "</project>";
+
+ /**
+ * Create module.xml file.
*
+ * @param mavenProject the maven project.
* @param dir directory where to write the file.
+ * @throws IOException if an IO error occured.
+ */
+ private void createModuleFile(
+ Project mavenProject,
+ File dir
+ ) throws IOException
+ {
+ write( dir, MODULE, "module.xml" );
+ }
+
+ /**
+ * Create standard build.xml file.
+ *
* @param mavenProject the maven project.
+ * @param dir directory where to write the file.
* @throws IOException if an IO error occured.
*/
- private void createStandardBuild( File dir, Project mavenProject )
throws IOException
+ private void createStandardBuild(
+ Project mavenProject,
+ File dir
+ )
+ throws IOException
{
StringBuffer content = new StringBuffer( INITIAL_SIZE );
content.append( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" );
- content.append( "<project name=\"" + mavenProject.getName() + "\"
default=\"install\" basedir=\".\"\n" );
+ content.append( "<project name=\"" + mavenProject.getArtifactId() +
"\" default=\"install\" basedir=\".\"\n" );
content.append( " xmlns:magic=\"antlib:net.dpml.magic\">\n" );
content.append( "\n" );
content.append( " <magic:import
uri=\"artifact:template:dpml/magic/standard\"/>\n" );
content.append( " <magic:import
uri=\"artifact:template:dpml/magic/checkstyle\"/>\n" );
content.append( "\n" );
content.append( "</project>\n" );
- write( dir, content.toString() );
+ write( dir, content.toString(), "build.xml" );
}

/**
* Create a reactor build.xml file.
*
- * @param dir directory where to write the file.
+ * @param project the maven project.
+ * @param dir directory where to write the file.
* @throws IOException if an IO error occured.
*/
- private void createReactorBuild( File dir )
+ private void createReactorBuild(
+ Project project,
+ File dir
+ )
throws IOException
{
StringBuffer content = new StringBuffer( INITIAL_SIZE );
content.append( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" );
- content.append( "<project name=\"maven-migrate\" default=\"default\"
basedir=\".\"\n" );
+ content.append( "<project name=\"" + project.getArtifactId() + "\"
default=\"default\" basedir=\".\"\n" );
content.append( " xmlns:magic=\"antlib:net.dpml.magic\">\n" );
content.append( "\n" );
content.append( " <magic:import
uri=\"artifact:template:dpml/magic/reactor\"/>\n" );
content.append( "\n" );
content.append( "</project>\n" );
- write( dir, content.toString() );
+ write( dir, content.toString(), "build.xml" );
}

/**
* Write the content of a string to a file.
*
- * @param dir directory where to write the file.
- * @param content the content to write.
+ * @param dir directory where to write the file.
+ * @param content the content to write.
+ * @param filename the file name.
* @throws FileExistsException if the file already exists.
* @throws IOException if cannot write the file.
*/
- private void write( File dir, String content ) throws
FileExistsException, IOException
+ private void write(
+ File dir,
+ String content,
+ String filename
+ ) throws FileExistsException, IOException
{
- File buildDotXml = new File( dir, "build.xml" );
+ File buildDotXml = new File( dir, filename );
+/*
if( buildDotXml.exists() )
{
- throw new FileExistsException( buildDotXml );
+ throw new FileExistsException( buildDotXml.getCanonicalPath() );
}
+*/
FileOutputStream fos = new FileOutputStream( buildDotXml );
try
{

Modified:
development/laboratory/maven/magic-migrate/src/test/net/dpml/magic/maven/migrate/MigateTest.java
==============================================================================
---
development/laboratory/maven/magic-migrate/src/test/net/dpml/magic/maven/migrate/MigateTest.java
(original)
+++
development/laboratory/maven/magic-migrate/src/test/net/dpml/magic/maven/migrate/MigateTest.java
Wed Jan 12 02:29:54 2005
@@ -25,28 +25,22 @@
import java.net.URISyntaxException;

import org.apache.maven.MavenException;
+import org.apache.maven.project.Project;

/**
* @author <a href="mailto:mraad AT e-iit.com";>mansour</a>
*/
-public class MigateTest
- extends TestCase
+public class MigateTest extends TestCase
{

public void testMigrate() throws URISyntaxException, MavenException,
IOException
{
- final Migrate migrate = new Migrate();
- final File basedir = new File( "." );
/*
- final File mavenFile = new File(basedir, "project.xml"); // Create file
with parent file, or NPE will be thrown.
- final org.apache.maven.project.Project project =
org.apache.maven.MavenUtils.getProject(mavenFile, null, false);
- migrate.createBuilds(project, null);
- final java.util.List list = project.getDependencies();
- for (int i = 0; i < list.size(); i++) {
- final org.apache.maven.project.Dependency dependency =
(org.apache.maven.project.Dependency) list.get(i);
- System.out.println(dependency.getGroupId()+"
"+dependency.getArtifact()+" "+dependency.getVersion());
- }
+ Migrate migrate = new Migrate();
+ File cwd = new File( "." );
+ File mavenFile = new File( cwd, "project.xml" ); // Create file with
parent file, or NPE will be thrown.
+ Project project = org.apache.maven.MavenUtils.getProject( mavenFile,
null, false );
+ migrate.createBuilds( project, null );
*/
- migrate.createBuilds( basedir );
}
}
\ No newline at end of file



  • svn commit: r1464 - in development/laboratory/maven/magic-migrate: . src/conf src/main/net/dpml/magic/maven/migrate src/test/net/dpml/magic/maven/migrate, mraad23, 01/11/2005

Archive powered by MHonArc 2.6.24.

Top of Page