0

I have 2 different JAVA 11 child projects based on the same parent maven pom.xml.

The first one was set up with Spring initializer for Maven from the beginning and the second one was set up initially without SpringBoot.

The second one was giving me headaches because it was missing some dependencies (JAI, JPEG2000) which were in the parent pom.xml and well included in the first project which used Spring maven plugin to package the app, but not in the second one.

That's why I decided to move the second project to SpringBoot. But it still misses the same dependencies as previously and when I print the loaded classes it still shows : /home/path/to/netbeans/java/maven/boot/plexus-classworlds-2.6.0.jar (I am using Netbeans 12) whereas the first project lists all loaded jars as it is expected to do. This second project pom.xml reads as follows :




<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>My.Package</groupId>
   <artifactId>PyProg</artifactId>
   <version>1.0.0</version>
   <packaging>jar</packaging>
   <name>My prog Name</name>
   <description>SpringBoot version of My Prog</description>
   <parent>
      <artifactId>MySuperParent</artifactId>
      <groupId>My.Package</groupId>
      <version>1.0-SNAPSHOT</version>
   </parent>
   <!--Uses a different parent than Spring Boot one see https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-maven-without-a-parent-->
   <dependencyManagement>
      <dependencies>
         <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>2.1.16.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
         </dependency>
      </dependencies>
   </dependencyManagement>
   <dependencies>
      <dependency>
         <groupId>My.Package</groupId>
         <artifactId>Base</artifactId>
         <version>1.0-SNAPSHOT</version>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.openjfx</groupId>
         <artifactId>javafx-fxml</artifactId>
         <version>11.0.2</version>
         <type>jar</type>
      </dependency>
      <dependency>
         <groupId>org.openjfx</groupId>
         <artifactId>javafx-controls</artifactId>
         <version>11.0.2</version>
         <type>jar</type>
      </dependency>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <scope>test</scope>
         <version>${junitVersion}</version>
         <type>jar</type>
      </dependency>
      <dependency>
         <groupId>org.openjfx</groupId>
         <artifactId>javafx-maven-plugin</artifactId>
         <version>0.0.2</version>
         <type>maven-plugin</type>
      </dependency>
   </dependencies>
   <build>
      <resources>
         <resource>
            <!--Resource folder that should be included-->
            <directory>src/main/resources</directory>
            <!--Resources that should not-->
            <excludes>
               <exclude>solo/**</exclude>
               <exclude>forYourEyesOnly/**</exclude>
            </excludes>
         </resource>
      </resources>
      <plugins>
         <!-- Package as an executable jar -->
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.1.16.RELEASE</version>
            <executions>
               <execution>
                  <goals>
                     <goal>repackage</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
</project>

Plexus-classworlds is not in any pom, both projects pom look alike now that I moved the second one to SpringBoot, so how can I disable plexus-classworlds and get rid of it, so that when doing System.out.println(System.getProperty("java.class.path").replace(":","\n")); to get the loaded classes from class path, I see a list not this single plexus-classworlds jar ?

I believe I may have messed up with some config file sometime in the past that enabled this plexus-classworlds, but I can't remember.

I tried to remove this jars from Netbeans but then none of the projects boots up.

So could somebody tell me how to get rid of plexus-classworlds.jar shown in the classpath ?

Any hint appreciated!

HelloWorld
  • 2,275
  • 18
  • 29
  • First do not use maven-plugins as dependencies. (`javafx-maven-plugin`) and more important use up-to-date parts javafx-maven-plugin existing a newer version and also spring boot. Furthermore you should build your project on plain command line first....and check if everything can be reached and build... – khmarbaise Feb 24 '22 at 06:20
  • Thank you @khmarbaise, I've followed your advices not to use javafx-maven-plugin and to build from command line first (I don't want to update to newer spring boot now in case it breaks something else, but I may try it later). Now it shows the generated jar in the class path (instead of plexus-classworlds that appears when run from Netbeans) but still does not use the included jars I can see in `/BOOT-INF/lib/`. – HelloWorld Feb 24 '22 at 06:54
  • I have not suggested to to remove javafx-maven-plugin. I have suggested to remove it as a dependency. If you like to use you have to define it in plugin context...check the documentation about plugins. Furthermore upgrade spring boot is neccesary because spring version 2.1.X is end of OSS support (https://spring.io/projects/spring-boot#support) – khmarbaise Feb 24 '22 at 07:03
  • Ooops, I misunderstood you sorry! Yet it works without it and the other project does not have it. I will try to update SpringBoot to see if it run. But the other project runs fine so this one should also run. – HelloWorld Feb 24 '22 at 07:08
  • No problem. Using something which is running is one thing. Use out dated software is a security risk apart from blocking future upgrades... – khmarbaise Feb 24 '22 at 07:19

0 Answers0