Skip to content

Commit

Permalink
PACKMP-19 Fix Plugin-BuildDate timestamp format
Browse files Browse the repository at this point in the history
  • Loading branch information
saberduck authored and cody-simms-sonarsource committed Sep 26, 2023
1 parent 2f22780 commit 490b6af
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.io.File;
import java.io.IOException;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
Expand Down Expand Up @@ -63,6 +65,8 @@
@Mojo(name = "sonar-plugin", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true)
public class SonarPluginMojo extends AbstractSonarMojo {

private static final DateTimeFormatter DATETIME_PATTERN = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ")
.withZone(ZoneId.from(ZoneOffset.UTC));
private static final String LIB_DIR = "META-INF/lib/";
private static final String[] DEFAULT_EXCLUDES = new String[]{"**/package.html"};
private static final String[] DEFAULT_INCLUDES = new String[]{"**/**"};
Expand Down Expand Up @@ -159,7 +163,7 @@ public File createArchive() {
addManifestProperty(PluginManifestProperty.ORGANIZATION_URL, getPluginOrganizationUrl());
addManifestProperty(PluginManifestProperty.TERMS_CONDITIONS_URL, getPluginTermsConditionsUrl());
addManifestProperty(PluginManifestProperty.ISSUE_TRACKER_URL, getPluginIssueTrackerUrl());
addManifestProperty(PluginManifestProperty.BUILD_DATE, DateTimeFormatter.ISO_INSTANT.format(getBuildDate()));
addManifestProperty(PluginManifestProperty.BUILD_DATE, DATETIME_PATTERN.format(getBuildDate()));
addManifestProperty(PluginManifestProperty.SOURCES_URL, getPluginSourcesUrl());
addManifestProperty(PluginManifestProperty.DEVELOPERS, getDevelopers());
addManifestProperty(PluginManifestProperty.JRE_MIN_VERSION, getJreMinVersion());
Expand Down

0 comments on commit 490b6af

Please sign in to comment.