Skip to content

Commit

Permalink
Merge pull request #11 from codedx/bugfix/update-dependencies
Browse files Browse the repository at this point in the history
Bugfix/update dependencies
  • Loading branch information
tylercamp authored Mar 13, 2024
2 parents 7f17f88 + 991f822 commit b9cdeff
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 61 deletions.
8 changes: 4 additions & 4 deletions IntelliJNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ The following are some notes taken by a user who set up the plugin for developme

* Import pom.xml using IntelliJ

* Point IntelliJ to the Maven version installed to the Atlassian plugin SDK: File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Maven home directory. Default installation of the plugin SDK is in C:\Applications\Atlassian
* Point IntelliJ to the Maven version installed to the Atlassian plugin SDK: `File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Maven home directory`. Default installation of the plugin SDK on Windows is in `C:\Applications\Atlassian`. Set this field to the `apache-maven-...` folder in the SDK folder. (If you run `atlas-build` or `atlas-run`, some of the logs will typically reference the install path.)

* To run the built plugin in an instance of bamboo, run the bamboo:run maven task.
* To run the built plugin in an instance of bamboo, run the `bamboo:run` maven task.

* The plugin can be configured with QuickReload in the codedx-bamboo-plugin POM file. If this is set to true, a developer only needs to run bamboo:run, and then run atlas-mvn package in a seperate console session to build an updated version of the plugin, and have the Bamboo instance automatically reload the plugin.
* The plugin can be configured with QuickReload in the codedx-bamboo-plugin POM file. If this is set to true, a developer only needs to run `bamboo:run`, and then run atlas-mvn package in a separate console session to build an updated version of the plugin, and have the Bamboo instance automatically reload the plugin.

* When setting up bamboo, don't forget to configure your git install directory via the Server capabilities administration menu.

* To debug in Intellij: run bamboo:debug, then go to Run->Attach to local process... and select the Catalina process.
* To debug in Intellij: run `bamboo:debug`, then go to `Run->Attach to local process...` and select the Catalina process.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ codedx-bamboo-plugin
1. Install Atlassian Plugin SDK: (Windows url) - https://developer.atlassian.com/server/framework/atlassian-sdk/install-the-atlassian-sdk-on-a-windows-system/
Additional information about the SDK can be found here - https://developer.atlassian.com/display/DOCS/Introduction+to+the+Atlassian+Plugin+SDK

2. For development, IntelliJ is recommended. If stuck setting up IntelliJ, [some notes are included here](IntelliJNotes.md) from a user who set up the plugin for development in IntelliJ on Windows.
2. For development, IntelliJ is recommended. See [the notes included here](IntelliJNotes.md) for detailed instructions on how to configure IntelliJ to load the project and resolve dependencies.

3. If needed, update the Swagger client [following the instructions here](SwaggerSetup.md). This shouldn't be needed but may be necessary if there is a version mismatch with the Code Dx server.

Expand All @@ -30,7 +30,7 @@ codedx-bamboo-plugin

### Running and Debugging from Command Line

* The following commands can be used to run and debug the plugin from the root of this repository. Only the run command was tested (briefly), and it didn't work consistently.
* The following commands can be used to run and debug the plugin from the root of this repository. Only the run command was tested (briefly), and it didn't work consistently. (Normal `mvn` commands won't work, must use the `atlas-*` commands.)

`atlas-run`
`atlas-debug`
Expand Down
63 changes: 32 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.codedx</groupId>
<artifactId>codedx-bamboo-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0</version>

<organization>
<name>Code Dx</name>
Expand All @@ -19,20 +19,20 @@
<packaging>atlassian-plugin</packaging>

<properties>

<bamboo.version>6.3.2</bamboo.version>
<bamboo.data.version>6.3.2</bamboo.data.version>
<amps.version>6.3.15</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
<jersey-version>2.25.1</jersey-version>
<jackson-version>2.9.8</jackson-version>
<!-- note: change to 9.0.0 for local development with `atlas-run` etc., prior versions have a broken UI -->
<bamboo.version>7.1.1</bamboo.version>
<bamboo.data.version>${bamboo.version}</bamboo.data.version>
<amps.version>8.1.2</amps.version>
<plugin.testrunner.version>2.0.2</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.1.7</atlassian.spring.scanner.version>
<jersey-version>2.41</jersey-version>
<jackson-version>2.15.2</jackson-version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<junit-version>4.12</junit-version>
<junit-version>4.13.2</junit-version>
<swagger-core-version>1.5.15</swagger-core-version>

</properties>
Expand Down Expand Up @@ -64,13 +64,13 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.2</version>
<version>1.10.14</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
<version>2.8.9</version>
</dependency>

<!-- HTTP client: jersey-client -->
Expand Down Expand Up @@ -109,10 +109,10 @@
<dependency>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>2.6.4</version>
<version>${jackson-version}</version>
</dependency>

<!-- Base64 encoding that works in both JVM and Android -->
<!-- Note: Required by Swagger-generated API client impl. for Basic Auth, but basic auth is not used here -->
<dependency>
<groupId>com.brsanthu</groupId>
<artifactId>migbase64</artifactId>
Expand All @@ -125,32 +125,33 @@
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-bamboo-plugin</artifactId>
<artifactId>bamboo-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${bamboo.version}</productVersion>
<productDataVersion>${bamboo.data.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
</configuration>
</plugin>

<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>

<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
</pluginRepository>
</pluginRepositories>

</project>
24 changes: 16 additions & 8 deletions src/main/java/com/codedx/client/CustomInstantDeserializer.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
package com.codedx.client;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonTokenId;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils;
import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils;
import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase;
import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction;
import com.fasterxml.jackson.datatype.threetenbp.function.Function;
import org.threeten.bp.DateTimeException;
import org.threeten.bp.Instant;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZoneId;
import org.threeten.bp.ZonedDateTime;
import org.threeten.bp.*;
import org.threeten.bp.format.DateTimeFormatter;
import org.threeten.bp.temporal.Temporal;
import org.threeten.bp.temporal.TemporalAccessor;
Expand Down Expand Up @@ -147,13 +143,25 @@ protected CustomInstantDeserializer(CustomInstantDeserializer<T> base, DateTimeF
}

@Override
protected JsonDeserializer<T> withDateFormat(DateTimeFormatter dtf) {
protected ThreeTenDateTimeDeserializerBase<T> withDateFormat(DateTimeFormatter dtf) {
if (dtf == _formatter) {
return this;
}
return new CustomInstantDeserializer<T>(this, dtf);
}

@Override
protected ThreeTenDateTimeDeserializerBase<T> withLeniency(Boolean leniency) {
// not relevant for us
return this;
}

@Override
protected ThreeTenDateTimeDeserializerBase<T> withShape(JsonFormat.Shape shape) {
// not relevant for us
return this;
}

@Override
public T deserialize(JsonParser parser, DeserializationContext context) throws IOException {
//NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only
Expand Down Expand Up @@ -205,7 +213,7 @@ public T deserialize(JsonParser parser, DeserializationContext context) throws I

private ZoneId getZone(DeserializationContext context) {
// Instants are always in UTC, so don't waste compute cycles
return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone());
return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone());
}

private static class FromIntegerArguments {
Expand Down
14 changes: 4 additions & 10 deletions src/main/java/com/codedx/plugins/bamboo/CodeDxScanTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

import com.atlassian.bamboo.build.logger.BuildLogger;
import com.atlassian.bamboo.configuration.ConfigurationMap;
import com.atlassian.bamboo.task.TaskContext;
import com.atlassian.bamboo.task.TaskException;
import com.atlassian.bamboo.task.TaskResult;
import com.atlassian.bamboo.task.TaskResultBuilder;
import com.atlassian.bamboo.task.TaskType;
import com.atlassian.util.concurrent.NotNull;
import com.codedx.plugins.bamboo.utils.Archiver;
import com.codedx.plugins.bamboo.utils.CodeDxBuildStatistics;
import com.atlassian.bamboo.task.*;
import com.codedx.client.ApiClient;
import com.codedx.client.ApiException;
import com.codedx.client.api.*;
import com.codedx.plugins.bamboo.utils.Archiver;
import com.codedx.plugins.bamboo.utils.CodeDxBuildStatistics;
import org.apache.log4j.Logger;

import java.io.File;
Expand Down Expand Up @@ -62,8 +57,7 @@ private static class ScanTaskState {
List<GroupedCount> groupedCounts;
}

@NotNull
@java.lang.Override
@Override
public TaskResult execute(final TaskContext taskContext) throws TaskException
{
ScanTaskState state = new ScanTaskState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.atlassian.bamboo.bandana.PlanAwareBandanaContext;
import com.atlassian.bandana.BandanaContext;
import com.atlassian.bandana.BandanaManager;
import com.codedx.plugins.bamboo.security.SSLContextFactory;
import com.codedx.client.ApiClient;
import com.codedx.plugins.bamboo.security.SSLContextFactory;
import org.apache.log4j.Logger;
import org.glassfish.jersey.client.JerseyClientBuilder;

Expand All @@ -24,8 +24,8 @@ public class ServerConfigManager implements Serializable {
private static final String BANDANA_KEY = "com.codedx.bambooplugin:Config";

// This gets called automatically
public void setBandanaManager(BandanaManager bandanaManager) {
this.bandanaManager = bandanaManager;
public ServerConfigManager(BandanaManager bandanaManager) {
ServerConfigManager.bandanaManager = bandanaManager;
}

public static String getUrl() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/META-INF/spring/plugin-context.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner"
xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner/2"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.atlassian.com/schema/atlassian-scanner
http://www.atlassian.com/schema/atlassian-scanner/atlassian-scanner.xsd">
<atlassian-scanner:scan-indexes/>
</beans>
</beans>

0 comments on commit b9cdeff

Please sign in to comment.