mts icon indicating copy to clipboard operation
mts copied to clipboard

Cannot compile on a Mac with java 12

Open rjlouro opened this issue 5 years ago • 2 comments

Trying to compile MTS on a macbook pro and run into 2 problems:

Package javax.cml.bind does not exist:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project mts: Compilation failure: Compilation failure:
[ERROR] /Users/rjlouro/Documents/WIT/RCS/MTS_Git/mts/src/main/java/com/devoteam/srit/xmlloader/core/operations/basic/operators/PluggableParameterOperatorBinary.java:[66,21] error: package javax.xml.bind does not exist
[ERROR] /Users/rjlouro/Documents/WIT/RCS/MTS_Git/mts/src/main/java/com/devoteam/srit/xmlloader/core/operations/basic/operators/PluggableParameterOperatorBinary.java:[478,34] error: cannot find symbol

Solved by adding it to pom.xml. Tried version 2.3.0 and it worked.

--- a/pom.xml
+++ b/pom.xml
@@ -538,5 +538,10 @@
             <scope>system</scope>
             <systemPath>${basedir}/lib/jpcap.jar</systemPath>
         </dependency>
+       <dependency>
+               <groupId>javax.xml.bind</groupId>
+               <artifactId>jaxb-api</artifactId>
+               <version>2.3.0</version>
+       </dependency>
     </dependencies>
 </project>

Build fails with incompatible type

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project mts: Compilation failure: Compilation failure:
[ERROR] /Users/rjlouro/Documents/WIT/RCS/MTS_Git/mts/src/main/java/com/devoteam/srit/xmlloader/gui/model/ModelTreeRTStats.java:[251,77] error: incompatible types: Enumeration<TreeNode> cannot be converted to Enumeration<DefaultMutableTreeNode>
[ERROR] /Users/rjlouro/Documents/WIT/RCS/MTS_Git/mts/src/main/java/com/devoteam/srit/xmlloader/gui/model/ModelTreeRTStats.java:[302,77] error: incompatible types: Enumeration<TreeNode> cannot be converted to Enumeration<DefaultMutableTreeNode>

Solved by the following changes:

--- a/src/main/java/com/devoteam/srit/xmlloader/gui/model/ModelTreeRTStats.java
+++ b/src/main/java/com/devoteam/srit/xmlloader/gui/model/ModelTreeRTStats.java
@@ -248,7 +248,7 @@ public class ModelTreeRTStats extends DefaultTreeModel {
         boolean alreadyExist = false;

         // We get all children of node parent
-        Enumeration<DefaultMutableTreeNode> allChildren = nodeParent.children();
+        Enumeration allChildren = nodeParent.children();

         // For each child
         while (allChildren.hasMoreElements()) {
@@ -298,12 +298,12 @@ public class ModelTreeRTStats extends DefaultTreeModel {
         DefaultMutableTreeNode node = null;

         // We get all children of node parent
-        Enumeration<DefaultMutableTreeNode> allChildren = nodeParent.children();
+        Enumeration allChildren = nodeParent.children();

         // For each child
         while (allChildren.hasMoreElements()) {
             // Get the current child
-            node = allChildren.nextElement();
+            node = (DefaultMutableTreeNode) allChildren.nextElement();

             // If this child match (with the name) with the node searching
             if (node.toString().equals(nodeChild.toString())) {

My environment:

MacOS Mojave 10.14.6 

java 12.0.2 2019-07-16
Java(TM) SE Runtime Environment (build 12.0.2+10)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

rjlouro avatar Sep 26 '19 15:09 rjlouro

Hello, thanks for the feedback, we'll address that as soon as possible.

The current reference Java version is (still) 8.

egwepas avatar Oct 14 '19 07:10 egwepas

It would be nice to use the maven toolchains plugin (https://maven.apache.org/plugins/maven-toolchains-plugin/).

tnmtechnologies avatar May 28 '20 07:05 tnmtechnologies