I want to build an application with Maven. Currently I have the following setup:
- Two projects; Project A and Project B.
- Project B depends on A (with the dependency tag in the pom).
- The main Class is in project B.
I have included everything in Netbeans. Now when I change something in Project A i just want to hit the run button and it should compile everything needed and start the main method in proectB.
I tried to use a parent project and used it as the main project in Netbeans:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.masr</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>0.1-SNAPSHOT</version>
<modules>
<module>ProjectA</module>
<module>ProjectB</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>com.projectB.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
The Reactor plugin now checks for changes in the projects and compiles them if needed. However the exec-maven-plugin does not work here and has to be placed in Project B. But when I do this I need to run project B again.
If I set project B as the main project and hit the run button, Netbeans wont realize that it needs to recompile project A, if there are changes.
How can I make this work?