Skip to content

Commit a797831

Browse files
committed
Fix issue #22
pipeline-maven is declared as optional, but jenkins injection fails at startup time looking for pipeline-maven configuration.
1 parent 47cc074 commit a797831

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/hudson/plugins/depgraph_view/model/graph/edge/PipelineGraphPublisherEdgeProvider.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@
4747
public class PipelineGraphPublisherEdgeProvider implements EdgeProvider {
4848

4949
private final Jenkins jenkins;
50-
private final GlobalPipelineMavenConfig globalPMConfig;
5150
private final boolean isPluginInstalled;
5251
private final static Logger LOGGER = Logger.getLogger(PipelineGraphPublisherEdgeProvider.class.getName());
5352

5453
@Inject
5554
public PipelineGraphPublisherEdgeProvider(Jenkins jenkins) {
5655
this.jenkins = jenkins;
57-
this.globalPMConfig = ExtensionList.lookupSingleton(GlobalPipelineMavenConfig.class);
5856
this.isPluginInstalled = jenkins.getPlugin("pipeline-maven") != null;
5957
}
6058

@@ -64,6 +62,7 @@ public Iterable<Edge> getUpstreamEdgesIncidentWith(Job<?, ?> project) {
6462
if (!isPluginInstalled) {
6563
return edges;
6664
}
65+
GlobalPipelineMavenConfig globalPMConfig = ExtensionList.lookupSingleton(GlobalPipelineMavenConfig.class);
6766
if (globalPMConfig != null && project instanceof WorkflowJob) {
6867
PipelineMavenPluginDao dao = globalPMConfig.getDao();
6968
if (project.getLastSuccessfulBuild() != null) {
@@ -83,6 +82,10 @@ public Iterable<Edge> getUpstreamEdgesIncidentWith(Job<?, ?> project) {
8382
@Override
8483
public Iterable<Edge> getDownstreamEdgesIncidentWith(Job<?, ?> project) {
8584
List<Edge> edges = new ArrayList<>();
85+
if (!isPluginInstalled) {
86+
return edges;
87+
}
88+
GlobalPipelineMavenConfig globalPMConfig = ExtensionList.lookupSingleton(GlobalPipelineMavenConfig.class);
8689
if (globalPMConfig != null && project instanceof WorkflowJob) {
8790
PipelineMavenPluginDao dao = globalPMConfig.getDao();
8891
if (project.getLastSuccessfulBuild() != null) {

0 commit comments

Comments
 (0)