Code Monkey home page Code Monkey logo

make-pom's Introduction

make-pom

This bash script creates the dependencies part of a pom.xml file from a collection of jars. For each jar we have to find the groupId, artifactId and version. This script is useful when converting a project from ant to maven.

To discover this information the script does the following:

  1. It first looks inside the jar for META-INF/maven/
  2. then it tries to search for the jar by SHA1 checksum on search.maven.org
  3. then finally it puts a comment in pom.xml with information about the jar manifest to help you in locating the dependency yourself. Of course you may not find the jar anywhere and then you'll have to host it in your own private maven repository.

Usage

Execute these commands to run the script. It will recursively process the directory you specify.

	$ git clone https://github.com/sjbotha/make-pom.git
	Cloning into 'make-pom'...
	remote: Enumerating objects: 8, done.
	remote: Counting objects: 100% (8/8), done.
	remote: Compressing objects: 100% (7/7), done.
	remote: Total 8 (delta 1), reused 8 (delta 1), pack-reused 0
	Unpacking objects: 100% (8/8), done.

	$ chmod +x make-pom/make-pom.sh

	$ make-pom/make-pom.sh ~/myproject/lib
	jakarta-oro-2.0.8.jar found dep info at search.maven.org
	log4j-over-slf4j-1.7.12.jar found dep info in jar
	mail.jar ***** dep info not found *****

	$ cat myproject/lib/pom.xml
	<!-- jakarta-oro-2.0.8.jar -->
	<!-- Found info on search.maven.org for jakarta-oro-2.0.8.jar -->
	 <dependency>
	 <groupId>oro</groupId>
	 <artifactId>oro</artifactId>
	 <version>2.0.8</version>
	 </dependency>
	 
	<!-- log4j-over-slf4j-1.7.12.jar -->
	<dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>log4j-over-slf4j</artifactId>
		<version>1.7.12</version>
	</dependency>

	<!-- mail.jar -->
	<!-- TODO find the dep info for jar mail.jar
	Manifest-Version: 1.0
	Implementation-Version: 1.3.3_01
	Specification-Title: JavaMail(TM) API Design Specification
	Specification-Version: 1.3
	Extension-Name: javax.mail
	Created-By: 1.3.1 (Sun Microsystems Inc.)
	Implementation-Vendor-Id: com.sun
	Implementation-Vendor: Sun Microsystems, Inc.
	Specification-Vendor: Sun Microsystems, Inc.
	SCCS-ID: @(#)javamail.mf	1.5 02/03/14

	Name: javax/mail/search/SearchTerm.class
	SHA1-Digest: bJeLilaOUG6Et+Aio7NaAHhvZks=

	Name: javax/mail/SendFailedException.class
	-->
	<dependency>
		<groupId>mail.jar</groupId>
		<artifactId>mail.jar</artifactId>
		<version>1.3.3_01</version>
	</dependency>

I tested this on cygwin with bash. It should work on linux too.

Dependencies

  • bash
  • sha1sum
  • python

I think these dependencies were included in my cygwin by default.

TODO

Can probably enhance it to search additional repositories by checksum

make-pom's People

Contributors

sjbotha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.