Friday, July 12, 2019

Creating Maven from non-Maven project in NetBeans.

I have a project in NetBeans that is difficult to commit to a version control system (VCS), since the libraries are not saved to the VCS. For several reasons, it is a bad idea to try to save the libraries to the VCS: they are binaries, many duplicates of the files could be saved to the VCS.

An alternative is to use Maven. The POM file in Maven references all the necessary libraries. When the project is downloaded from the VCS, opened, and run, the POM will guarantee that all necessary libraries are downloaded from the cloud.

I have created a new Maven project and am copying the files from the original project into the new Maven project. I will list the libraries that are missing as I copy.

Libraries:

  • org.apache,commons.beanutils - 1.9.3 [jar] local
  • org.apache.log4j - 1.2.15 [jar]
  • org.hibernate.validator.engine - 6.0.10.Final [jar]
  • org.hibernate - 5.2.17
  • org.springframework.beans - 5.0.8 RELEASE [jar] local
  • org.springframework.web - 5.0.8 RELEASE [jar] local
  • org.springframework.context - 5.0.8 RELEASE [jar] local
  • org.springframework.transaction - 5.0.8 RELEASE [jar] local
  • org.springframework.web.servlet - 5.0.8 RELEASE [jar] local 
  • org.springframework.jdbc - 5.0.8 RELEASE [jar] local 
  • org.springframework.orm - 4.2.5 RELEASE [jar] local 
Missing Libraries:
  • com.paypal.sdk.core .exceptions . profiles .services
  • com.fedex.ws.rate
  • org.apache.fop
  • org.apache.xmlgraphics
  • org.w3c.tidy
  • org.apache.avalon
In order to make the project portable, I must place the missing libraries into a remote Maven repo.
  • fop.jar
  • avalon-framework-4.2.0.jar
  • jtidy-r938.jar 
  • mailapi.jar
  • paypal_base.jar
  • paypal_juint.jar
  • RateService.jar
  • xmlgraphics-commons-1.4.jar
For now, I will place these into a folder on the website, until I figure out how to create a Maven repo.

Harder than I thought. To install into the local .m2/repository, run the maven install command  for each library:

    mvn install:install-file -Dfile=/Users/me/Downloads/jar-missing/jtidy-r938.jar
        -DgroupId=org.w3c.tidy -DartifactId=jtidy -Dversion=r938 -Dpackaging=jar

I edited the pom file for each library:

       
            org.w3c.tidy
            jtidy
            r938
            jar
       


I still needed more dependencies. These are used in log4j 1.2.15, but not in log4j 1.2.16. I upgraded to 1.2.16.

javax.jms:jms:jar:1.1
com.sun.jdmk:jmxtools:jar:1.2.1
com.sun.jmx:jmxri:jar:1.2.1

Two new dependencies were needed:

        <!-- https://mvnrepository.com/artifact/com.sun.xml/jaxws-rt -->
        <dependency>
            <groupid>com.sun.xml</groupid>
            <artifactid>jaxws-rt</artifactid>
            <version>2.0EA3</version>
        </dependency>
        <dependency>
            <groupid>javax.jws</groupid>
            <artifactid>jsr181-api</artifactid>
            <version>1.0-MR1</version>
        </dependency><br />

... and mysql:


        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupid>mysql</groupid>
            <artifactid>mysql-connector-java</artifactid>
            <version>8.0.16</version>
        </dependency>


I still needed jstl and standard for taglibs.

I will explore creating a remote repo.





No comments:

Post a Comment

Followers