db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1357713 - /db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
Date Thu, 05 Jul 2012 16:02:19 GMT
Author: tfischer
Date: Thu Jul  5 16:02:19 2012
New Revision: 1357713

URL: http://svn.apache.org/viewvc?rev=1357713&view=rev
Log:
Map entries are always passed as Strings from Maven; treat outputDirMap accordingly

Modified:
    db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java

Modified: db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java?rev=1357713&r1=1357712&r2=1357713&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
(original)
+++ db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
Thu Jul  5 16:02:19 2012
@@ -246,7 +246,7 @@ public class TorqueGeneratorMojo extends
      *
      * @parameter
      */
-    private Map<String, File> outputDirMap = new HashMap<String, File>();
+    private Map<String, String> outputDirMap = new HashMap<String, String>();
 
     /**
      * The work directory for e.g. merge sources.
@@ -517,16 +517,16 @@ public class TorqueGeneratorMojo extends
             {
                 outputDirMap.put(
                         Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY,
-                        new File(project.getBasedir()
+                        project.getBasedir()
                                 + "/"
-                                + Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR));
+                                + Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR);
             }
-            for (Map.Entry<String, File> outputDirMapEntry
+            for (Map.Entry<String, String> outputDirMapEntry
                     : outputDirMap.entrySet())
             {
                 projectPaths.setOutputDirectory(
                         outputDirMapEntry.getKey(),
-                        outputDirMapEntry.getValue());
+                        new File(outputDirMapEntry.getValue()));
                 getLog().debug("Setting output directory with key "
                         + outputDirMapEntry.getKey()
                         + " to "
@@ -691,10 +691,12 @@ public class TorqueGeneratorMojo extends
         }
         else
         {
-            if (outputDirUsageConvertedMap.get(Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY)
-                    == null
-                && outputDirMap.get(Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY)
-                    != null)
+            if (outputDirUsageConvertedMap.get(
+                    Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY)
+                      == null
+                && outputDirMap.get(
+                    Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY)
+                        != null)
             {
                 outputDirUsageConvertedMap.put(
                         Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY,
@@ -703,58 +705,59 @@ public class TorqueGeneratorMojo extends
             for (Map.Entry<String, OutputDirUsage> usageEntry
                     : outputDirUsageConvertedMap.entrySet())
             {
-                File outputDirPath = outputDirMap.get(usageEntry.getKey());
+                String outputDirPath = outputDirMap.get(usageEntry.getKey());
                 if (outputDirPath == null)
                 {
                     getLog().info("outputDirPath set for key "
                             + usageEntry.getKey()
                             + " ignoring this outputDirUsageMap entry");
+                    continue;
                 }
-                else if (!outputDirPath.exists())
+
+                File outputDirFile = new File(outputDirPath);
+                if (!outputDirFile.exists())
                 {
                     getLog().info("outputDirPath "
-                            + outputDirPath.getAbsolutePath()
+                            + outputDirFile.getAbsolutePath()
                             + " for outputDirUsageMap with key "
                             + usageEntry.getKey()
                             + " does not exist,"
                             + " ignoring this outputDirUsageMap entry");
+                    continue;
                 }
-                else
+                switch (usageEntry.getValue())
                 {
-                    switch (usageEntry.getValue())
-                    {
-                    case COMPILE:
-                        project.addCompileSourceRoot(outputDirPath.toString());
-                        getLog().debug("Added "
-                                + outputDirPath.toString()
-                                + " as compile source root");
-                        break;
-                    case TEST_COMPILE:
-                        project.addTestCompileSourceRoot(
-                                outputDirPath.toString());
-                        getLog().debug("Added "
-                                + outputDirPath.toString()
-                                + " as test compile source root");
-                        break;
-                    case RESOURCE:
-                        Resource resource = new Resource();
-                        resource.setDirectory(outputDirPath.toString());
-                        project.addResource(resource);
-                        getLog().debug("Added "
-                                + outputDirPath.toString()
-                                + " to the project resources");
-                        break;
-                    case TEST_RESOURCE:
-                        resource = new Resource();
-                        resource.setDirectory(outputDirPath.toString());
-                        project.addTestResource(resource);
-                        getLog().debug("Added "
-                                + outputDirPath.toString()
-                                + " to the project test resources");
-                        break;
-                    case NONE:
-                    default:
-                    }
+                case COMPILE:
+                    project.addCompileSourceRoot(outputDirPath.toString());
+                    getLog().debug("Added "
+                            + outputDirPath.toString()
+                            + " as compile source root");
+                    break;
+                case TEST_COMPILE:
+                    project.addTestCompileSourceRoot(
+                            outputDirPath.toString());
+                    getLog().debug("Added "
+                            + outputDirPath.toString()
+                            + " as test compile source root");
+                    break;
+                case RESOURCE:
+                    Resource resource = new Resource();
+                    resource.setDirectory(outputDirPath.toString());
+                    project.addResource(resource);
+                    getLog().debug("Added "
+                            + outputDirPath.toString()
+                            + " to the project resources");
+                    break;
+                case TEST_RESOURCE:
+                    resource = new Resource();
+                    resource.setDirectory(outputDirPath.toString());
+                    project.addTestResource(resource);
+                    getLog().debug("Added "
+                            + outputDirPath.toString()
+                            + " to the project test resources");
+                    break;
+                case NONE:
+                default:
                 }
             }
         }
@@ -806,7 +809,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param targetDir the target directory, or null to use the default.
      */
-    public void setOutputDir(String outputDirKey, File outputDir)
+    public void setOutputDir(String outputDirKey, String outputDir)
     {
         this.outputDirMap.put(outputDirKey, outputDir);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message