Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#673: Fixing NPE in UseDepVersionMojo caused by PatternIncludesArtifactFilter expecting a non-null classifier when using wildcards #675

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-common-artifact-filters</artifactId>
<version>3.3.1</version>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
Expand Down Expand Up @@ -274,6 +274,12 @@
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
andrzejj0 marked this conversation as resolved.
Show resolved Hide resolved
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.codehaus.mojo.versions;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import java.util.Collections;

import org.codehaus.mojo.versions.utils.BaseMojoTestCase;
import org.junit.Test;

/**
* Basic tests for {@linkplain UseDepVersionMojo}.
*
* @author Andrzej Jarmoniuk
*/
public class UseDepVersionMojoTest extends BaseMojoTestCase
{
@Test
public void testIssue673() throws Exception
{
UseDepVersionMojo mojo = createMojo( "use-dep-version",
"src/test/resources/org/codehaus/mojo/use-dep-version/issue-637-pom.xml" );
setVariableValueToObject( mojo, "processDependencies", true );
setVariableValueToObject( mojo, "processDependencyManagement", true );
setVariableValueToObject( mojo, "excludeReactor", true );
setVariableValueToObject( mojo, "serverId", "serverId" );
setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( mojo.getProject() ) );

mojo.execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Properties;

import org.apache.maven.model.Build;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.plugin.Mojo;
Expand Down Expand Up @@ -117,5 +120,17 @@ public Properties getProperties()
{
return getModel().getProperties();
}

@Override
public List<Dependency> getDependencies()
{
return getModel().getDependencies();
}

@Override
public DependencyManagement getDependencyManagement()
{
return getModel().getDependencyManagement();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>test-group</groupId>
<artifactId>test-artifact</artifactId>
<version>DEVELOP-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>test-group</groupId>
<artifactId>dep-artifact</artifactId>
<version>22.09.21</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>versions-maven-plugin</artifactId>
<configuration>
<depVersion>DEVELOP-SNAPSHOT</depVersion>
<includesList>test-group*:::JET*-SNAPSHOT</includesList>
</configuration>
</plugin>
</plugins>
</build>

</project>