GayaBalan / ivybeans

Automatically exported from code.google.com/p/ivybeans
0 stars 0 forks source link

Compile-on-save not working with ivybeans - was - Problem with Simple Java Application and IvyBeans in Netbeans 6.7.1 (java.lang.NoClassDefFoundError) #58

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Environment : ivybeans 1.1.1 netbeans 6.7.1 , OS Linux, jdk 1.6.0_15

Description : Running a simple Java Application doesn't work.

Step:

- New Installation of Netbeans 6.7.1 (netbeans-6.7.1-200907230101-ml.zip, 
unzip)
- New Installation of IvyBeans 1.1.1 (1247997655773_ivybeans-1.1, unzip)
- Install IvyBeans via "Tools->Plugins->Downloaded->Add Plugins"
- Create New Project "File->Java->Java Application-> Test" (with Main 
Class)
- Select Project -> Properties -> Ivy -> Enable Ivy "yes" -> "Ok"
- Select "Ivy Libraries" in Project -> "Add 
library" -> "commons-lang" -> "commons-lang" -> "2.4"
- Edit Main Class:
package javaapplication3;

import org.apache.commons.lang.StringUtils;

public class Main {

    public static void main(String[] args) {
        StringUtils.defaultString(null, "default");
    }
}
- Run Project:
run:
Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/commons/lang/StringUtils
        at javaapplication3.Main.main(Main.java:20)
Caused by: java.lang.ClassNotFoundException: 
org.apache.commons.lang.StringUtils
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 1 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Original issue reported on code.google.com by oliver.n...@gmail.com on 11 Sep 2009 at 8:39

GoogleCodeExporter commented 9 years ago
I've turned the Ant log level to DEBUG and then could see the text below:
--
Adding reference: ant.PropertyHelper
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-sun-1.6.0.16/jre
Detected OS: Linux
...
Setting ro project property: ant.file.{0} (run) ->
/home/luciano/.netbeans/6.7/var/cache/executor-snippets/run.xml
Project base dir set to: /home/luciano/.netbeans/6.7/var/cache/executor-snippets
 +Target: 
 +Target: run
Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
Build sequence for target(s) `run' is [run]
Complete build sequence is [run, ]
run:
Setting project property: classpath-translated ->
/home/luciano/NetBeansProjects/IvyTestApplication/build/classes:/home/luciano/Ne
tBeansProjects/IvyTestApplication/src
Override ignored for property "run.jvmargs"
Override ignored for property "work.dir"
Override ignored for property "application.args"
Executing '/usr/lib/jvm/java-6-sun/bin/java' with arguments:
'-Dfile.encoding=UTF-8'
'-classpath'
'/home/luciano/NetBeansProjects/IvyTestApplication/build/classes:/home/luciano/N
etBeansProjects/IvyTestApplication/src'
'ivytestapplication.Main'
The ' characters around the executable and arguments are
not part of the command.
...
---
As can be seen, the the jar files downloaded by Ivy are not part of classpath, 
and
only the run task is executed. The -ivy-retrieve task or any ivybeans related 
task is
not part of build sequence.
Is there any workaround while the fix is not released?

Original comment by lcbarcel...@gmail.com on 14 Sep 2009 at 3:34

GoogleCodeExporter commented 9 years ago
Well, I finally found a simple workaround. Just turn off the "Compile On Save" 
at
project preferences for Run and Debug start working.
It seems Netbeans use that .../executor-snippets/run.xml to define the run task 
and
.../executor-snippets/debug.xml to define the debug task when "Compile on Save" 
is
active.
What's the fix? Is Ivybeans missing to fulfill some requirement for working with
"Compile on save" or is Netbeans missing something when implementing that 
feature?

Original comment by lcbarcel...@gmail.com on 14 Sep 2009 at 1:47

GoogleCodeExporter commented 9 years ago
Thanks for the workaround. The question is good. How works the maven plugin in 
this 
case?

Original comment by oliver.n...@gmail.com on 14 Sep 2009 at 3:30

GoogleCodeExporter commented 9 years ago
I have the same kind of trouble with the maven support. When I want to be sure 
that my 
test will be launched correctly I often put the compile on save off.

I will investigate and try to find the guilty ;). 

Thanks for that.

Original comment by laurent....@gmail.com on 14 Sep 2009 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by laurent....@gmail.com on 14 Sep 2009 at 4:08

GoogleCodeExporter commented 9 years ago
Issue 78 has been merged into this issue.

Original comment by bruce.ch...@gmail.com on 9 Sep 2010 at 4:57

GoogleCodeExporter commented 9 years ago
so does Compile-on-save feature not work with ClassPathProvider mechanism in 
general, or does our ClassPathProviderImpl specifically not work properly with 
it.

I am assuming that it is only the run action for which there are problems 
between COS and ivybeans.

Will do some experiments to answer above questions.

Original comment by bruce.ch...@gmail.com on 9 Sep 2010 at 10:13