Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

pixee/pom-operator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actions Status Coverage

pom-operator

POM Operator is a library responsible for injecting dependencies into POM files programatically.

Building

Use Maven:

$ git clone git@github.com:pixee/pom-operator.git && cd pom-operator
$ mvn clean install

Using

There's a sample of usage from Java on the java-sample directory - of look under the src/test directory as well. TL;DR:

import org.junit.Test;

import io.github.pixee.maven.operator.ProjectModel;
import io.github.pixee.maven.operator.Dependency;
import io.github.pixee.maven.operator.POMOperator;
import io.github.pixee.maven.operator.ProjectModelFactory;

public class POMOperatorJavaTest {
  @Test
  public void testInterop() {
    ProjectModel projectModel = ProjectModelFactory
        .load(POMOperatorJavaTest.class.getResource("pom.xml"))
        .withDependency(
            new Dependency("org.dom4j", "dom4j", "0.0.0", null, "jar")
        );

    POMOperator.modify(projectModel);
  }
}

How it works?

It implements a Chain of Responsibility strategy - each Command class attempts a different way of fixing a POM, based around a Context (in this case, a ProjectModel)

Releasing

e.g. to generate version 0.0.2:

(mvn versions:set -DnewVersion=0.0.3 && git commit -am "Generating Tag" && git tag v0.0.3 && git push && git push --tags)
(export V='0.0.11-SNAPSHOT' ; mvn versions:set -DnewVersion=${V} && (cd java-sample ; mvn versions:set -DnewVersion=${V} && git commit -am "Generating development version" && git push))

TODO:

Deploying:

mvn -N -B deploy  -DaltDeploymentRepository=pixee-libs-release::default::https://pixee.jfrog.io/artifactory/default-maven-local
  • better readme
  • be able to guess existing indenting for existing documents
  • investigate leverage whats on versions-maven-plugin
  • consider fuzzying when testing