Enhancement 157 : ant enhancer: add capability of configuring a classpath
Priority 
Medium
Reported Version 
 
Logged By 
imario
Status 
Fixed
Fixed Version 
2.2.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
19/09/2009
Updated 
19/09/2009
Type 
Enhancement
 
Attachments 
No attachments

When using inheritance ebean needs to search for classes, sometimes such classes are located in other modules and thus can not be found within the output path of the "current" module. (dependency)

A "classpath" argument for ebeanEnhance would be great for this.


classSource="${project.build.outputDirectory}"
packages="com.ops.Premium.model.po.**" transformArgs="debug=0" />

 
imario 19 Sep 12:34
patch

Index: ../opsxcited_3rdpary/ebean/ant/src/main/java/com/avaje/ebean/enhance/ant/AntEnhanceTask.java
===================================================================
--- ../opsxcited_3rdpary/ebean/ant/src/main/java/com/avaje/ebean/enhance/ant/AntEnhanceTask.java (revision 362)
+++ ../opsxcited_3rdpary/ebean/ant/src/main/java/com/avaje/ebean/enhance/ant/AntEnhanceTask.java Sat Sep 19 14:23:23 CEST 2009
@@ -44,6 +43,8 @@
*/
public class AntEnhanceTask extends Task {

+ String classpath;
+
String classSource;

String classDestination;
@@ -57,8 +58,18 @@

File f = new File("");
System.out.println("Current Directory: "+f.getAbsolutePath());
-
+
- Transformer t = new Transformer(classSource, transformArgs);
+ StringBuilder extraClassPath = new StringBuilder();
+ extraClassPath.append(classSource);
+ if (classpath != null)
+ {
+ if (!extraClassPath.toString().endsWith(";"))
+ {
+ extraClassPath.append(";");
+ }
+ extraClassPath.append(classpath);
+ }
+ Transformer t = new Transformer(extraClassPath.toString(), transformArgs);

ClassLoader cl = AntEnhanceTask.class.getClassLoader();
OfflineFileTransform ft = new OfflineFileTransform(t, cl, classSource, classDestination);
@@ -67,6 +78,20 @@
}

/**
+ * the classpath used to search for e.g. inerited classes
+ */
+ public String getClasspath() {
+ return classpath;
+ }
+
+ /**
+ * the classpath used to search for e.g. inerited classes
+ */
+ public void setClasspath(String classpath) {
+ this.classpath = classpath;
+ }
+
+ /**
* Set the directory holding the class files we want to transform.
*/
public void setClassSource(String source) {

imario 19 Sep 12:35
applied

to ebean head.

Rob, if you are fine with it, please close this issue.

woResponse

Upload a file