Skip to content

Commit

Permalink
Fixed developer info in released pom.
Browse files Browse the repository at this point in the history
  • Loading branch information
kelemen committed Jan 9, 2022
1 parent a6bb333 commit 4614803
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions buildSrc/src/main/groovy/org/jtrim2/build/MavenConfigurer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import org.gradle.api.Project;
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
import org.gradle.api.publish.PublishingExtension;
import org.gradle.api.publish.maven.MavenPom;
import org.gradle.api.publish.maven.MavenPomDeveloper;
import org.gradle.api.publish.maven.MavenPublication;
import org.gradle.plugins.signing.SigningExtension;

Expand Down Expand Up @@ -78,18 +80,23 @@ private void configureMainPublication(MavenPublication publication) {
});
});

jtrimDev.getDevelopers().whenObjectAdded(addedDev -> {
pom.developers(developers -> {
developers.developer(developer -> {
developer.getId().set(addedDev.getName());
developer.getName().set(addedDev.getDisplayName());
developer.getEmail().set(addedDev.getEmail());
});
});
});
jtrimDev.getDevelopers().forEach(dev -> addDeveloper(pom, dev));
jtrimDev.getDevelopers().whenObjectAdded(addedDev -> addDeveloper(pom, addedDev));
jtrimDev.getDevelopers().whenObjectRemoved(removedDev -> {
throw new IllegalStateException("Cannot handle removal of developer.");
});
});
}

private void addDeveloper(MavenPom pom, JTrimDeveloper dev) {
pom.developers(developers -> {
developers.developer(pomDevNode -> addDeveloper(pomDevNode, dev));
});
}

private void addDeveloper(MavenPomDeveloper pomDevNode, JTrimDeveloper dev) {
pomDevNode.getId().set(dev.getName());
pomDevNode.getName().set(dev.getDisplayName());
pomDevNode.getEmail().set(dev.getEmail());
}
}

0 comments on commit 4614803

Please sign in to comment.