Seems like me addition of the LICENSE.txt and NOTICE.txt with:
<resource>
<directory>${pom.basedir}</directory>
<targetPath>META-INF</targetPath>
<includes>
<include>LICENSE.txt</include>
<include>NOTICE.txt</include>
</includes>
</resource>
Is causing this to pop up... and short of fixing the eclipse plugin
to be more intelligent about re-including paths that duplicate, I
think I will just setup a common antrun task to handle copying these
files into place.
Should fix the eclipse projects for now... until we find some other
similar resource def that causes it to blow up.
--jason
On Aug 20, 2006, at 9:43 PM, Gianny Damour wrote:
This is cool that this also works in IDEA.
Regarding this proble, this is the script that I use to fix
the .classpath (from the geronimo dir):
ls */*/.classpath | while read file; do cat $file | grep -v classes/
META-INF > ${file}_new; mv ${file}_new $file; done
BTW, in Eclipse System.getProperty("basedir", System.getProperty
("user.dir")) was working as by default Eclipse starts JUnit tests
in the project working directory, i.e. the module root.
Thanks,
Gianny
On 21/08/2006, at 2:25 PM, Jason Dillon wrote:
This was more what I was thinking:
<snip>
protected final File getBaseDir() {
File dir;
// If ${basedir} is set, then honor it
String tmp = System.getProperty("basedir");
if (tmp != null) {
dir = new File(tmp);
}
else {
// Find the directory which this class (or really the sub-
class of TestSupport) is defined in.
String path = getClass().getProtectionDomain
().getCodeSource().getLocation().getFile();
// We expect the file to be in target/test-classes, so go
up 2 dirs
dir = new File(path).getParentFile().getParentFile();
// Set ${basedir} which is needed by logging to initialize
System.setProperty("basedir", dir.getPath());
}
return dir;
}
</snip>
Appears to work well too, in IDEA at least, probably works fine in
Eclipse too... but I've got a ton of "Cannot nest output
folder..." errors that prevent me from actually checking.
--jason
On Aug 19, 2006, at 8:11 AM, Dain Sundstrom wrote:
I don't think that trick will work for an IDE, as it will only
tell you which directory the IDE started in. In intellij you can
use something like this:
public static String baseDir() {
Class myClass = null; // TestClass.class
URL classUrl = myClass.getClassLoader().getResource
(myClass.getName().replace('.', '/') + ".class");
if (classUrl == null) {
throw new RuntimeException("Could not find TestClass");
}
File targetDir = null;
try {
URLConnection urlConnection = classUrl.openConnection();
if (urlConnection instanceof JarURLConnection) {
JarURLConnection jarConnection =
(JarURLConnection) urlConnection;
classUrl = jarConnection.getJarFileURL();
targetDir = new File(new URI(classUrl.toString
())).getParentFile();
} else {
File classesDir = new File(new URI
(classUrl.toString())).getParentFile();
for (char c : myClass.getName().toCharArray()) {
if (c == '.') {
classesDir = classesDir.getParentFile();
}
}
}
} catch (Exception e) {
log.debug("Could not determine classes installation
directory", e);
}
if (targetDir != null) {
File moduleDir = targetDir.getParentFile();
return moduleDir.getAbsolutePath();
} else {
return System.getProperty("basedir",
System.getProperty("user.dir"));
}
}
Make sure to test this code, because I didn't :)
-dain
On Aug 18, 2006, at 4:47 PM, Jason Dillon wrote:
Ya, I will add that as soon as I can verify that it works in
IDEA an Eclipse... probably sometime next week.
--jason
On Aug 18, 2006, at 4:31 PM, Gianny Damour wrote:
On 19/08/2006, at 9:15 AM, [EMAIL PROTECTED] wrote:
Author: jdillon
Date: Fri Aug 18 16:15:53 2006
New Revision: 432773
URL: http://svn.apache.org/viewvc?rev=432773&view=rev
Log:
Comments about BASEDIR and IDE magic
Modified:
geronimo/trunk/modules/geronimo-testsupport/src/main/java/
org/apache/geronimo/testsupport/TestSupport.java
Modified: geronimo/trunk/modules/geronimo-testsupport/src/main/
java/org/apache/geronimo/testsupport/TestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/
geronimo-testsupport/src/main/java/org/apache/geronimo/
testsupport/TestSupport.java?
rev=432773&r1=432772&r2=432773&view=diff
=================================================================
=============
--- geronimo/trunk/modules/geronimo-testsupport/src/main/java/
org/apache/geronimo/testsupport/TestSupport.java (original)
+++ geronimo/trunk/modules/geronimo-testsupport/src/main/java/
org/apache/geronimo/testsupport/TestSupport.java Fri Aug 18
16:15:53 2006
@@ -37,6 +37,12 @@
private static final File BASEDIR;
static {
+ //
+ // TODO: Add some special magic here to figure this
out when we are running from
+ // and IDE, like IDEA or Eclipse. user.dir/
target might work... but need
+ // to validate what env each IDE has this set to.
+ //
+
String tmp = System.getProperty("basedir");
Hi Jason,
This is the trick that Dain has suggested:
private static final tmp = System.getProperty("basedir",
System.getProperty("user.dir"));
Thanks,
Gianny
if (tmp == null) {
throw new Error("Missing 'basedir' property;
tests need this property set to run correctly");