So I have a maven project which produces a jar package containing some ant tasks.
When I run my ant build script somewhere else with jpda open, and debug the tasks, say MyTask with NetBeans, the Apple Code Changes button doesn’t work. Here is the output of the netbeans console:
cd /trunks/tasks; JAVA_HOME=/opt/jdk /opt/netbeans-7.0/java/maven/bin/mvn -Djpda.stopclass=com.abc.ant.MyTask compile
Scanning for projects...
------------------------------------------------------------------------
Building tasks 1.0-SNAPSHOT
------------------------------------------------------------------------
[resources:resources]
Using 'UTF-8' encoding to copy filtered resources.
Copying 1 resource to com/abc/ant
[compiler:compile]
Compiling 1 source file to /trunks/tasks/build/classes
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.548s
Finished at: Fri Mar 09 17:45:24 CST 2012
Final Memory: 11M/149M
------------------------------------------------------------------------
NetBeans: classes to reload: []
NetBeans: No class to reload
So Netbeans does successfully tell Maven what class needs to be compiled. However, NetBeans won’t reload the compiled class. Is it because my ant process is using the jar package produced by the Maven project, or because of other reasons?
Note: I have some custom configurations, like where to output the compiled classes, and where to put the jar package. Could that be a reason?
Update 2:
OK I found the reason by myself.
It’s because I added the following line under <build> in the pom.xml:
<directory>${my.custom.work.dir}/build</directory>
So maven will output the compiled class files to this directory, rather than the default ${basedir}/target. However, Netbeans seems to be too stupid to recognize that — it just tries the default directory.
Now the question could be much easier: is there any way to make the IDE recognize that by adding configuration in the pom?
In
[your_home_path]/.netbeans/7.0/maven/confyou will find asetting.xmlfile.Here you can set
${my.custom.work.dir}in<profiles>tagYou can find examples here (in section Properties)
Edit :
It works for me with this kind of POM (in Netbeans 7.0.1) :