Skip to content
Open
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
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ under the License.

<properties>
<javaVersion>8</javaVersion>
<mavenVersion>3.9.16</mavenVersion>
<mavenVersion>3.10.0</mavenVersion>
<!-- Maven bound -->
<resolverVersion>1.9.27</resolverVersion>
<resolverVersion>2.0.24</resolverVersion>
<!-- Maven bound -->
<slf4jVersion>1.7.36</slf4jVersion>
<slf4jVersion>2.0.19</slf4jVersion>

<!-- plugins version used in IT tests -->
<mavenAntrunPluginVersion>${version.maven-antrun-plugin}</mavenAntrunPluginVersion>
Expand Down
24 changes: 19 additions & 5 deletions src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.Mockito.when;

Expand Down Expand Up @@ -191,7 +192,8 @@ void testSkippingDeploy(DeployMojo mojo) throws Exception {
mojo.execute();

File[] files = localRepo.listFiles();
assertNull(files);
// the resolver may create an empty local repository directory
assertTrue(files == null || files.length == 0);

files = remoteRepo.listFiles();
assertNull(files);
Expand Down Expand Up @@ -409,7 +411,9 @@ void testNonPomDeployWithAttachedArtifactsOnly(DeployMojo mojo) throws Exception
@InjectMojo(goal = "deploy")
void testLegacyAltDeploymentRepositoryWithDefaultLayout(DeployMojo mojo) throws Exception {
assertEquals(
new RemoteRepository.Builder("altDeploymentRepository", "default", "http://localhost").build(),
new RemoteRepository.Builder("altDeploymentRepository", "default", "http://localhost")
.setIntent(RemoteRepository.Intent.DEPLOYMENT)
.build(),
mojo.getDeploymentRepository(
mavenProject, null, null, "altDeploymentRepository::default::http://localhost"));
}
Expand Down Expand Up @@ -450,7 +454,9 @@ void testInsaneAltDeploymentRepository(DeployMojo mojo) {
@InjectMojo(goal = "deploy")
void testDefaultScmSvnAltDeploymentRepository(DeployMojo mojo) throws Exception {
assertEquals(
new RemoteRepository.Builder("altDeploymentRepository", "default", "scm:svn:http://localhost").build(),
new RemoteRepository.Builder("altDeploymentRepository", "default", "scm:svn:http://localhost")
.setIntent(RemoteRepository.Intent.DEPLOYMENT)
.build(),
mojo.getDeploymentRepository(
mavenProject, null, null, "altDeploymentRepository::default::scm:svn:http://localhost"));
}
Expand All @@ -475,7 +481,9 @@ void testLegacyScmSvnAltDeploymentRepository(DeployMojo mojo) {
@InjectMojo(goal = "deploy")
void testAltSnapshotDeploymentRepository(DeployMojo mojo) throws Exception {
assertEquals(
new RemoteRepository.Builder("altSnapshotDeploymentRepository", "default", "http://localhost").build(),
new RemoteRepository.Builder("altSnapshotDeploymentRepository", "default", "http://localhost")
.setIntent(RemoteRepository.Intent.DEPLOYMENT)
.build(),
mojo.getDeploymentRepository(
mavenProject, "altSnapshotDeploymentRepository::http://localhost", null, null));
}
Expand All @@ -486,12 +494,18 @@ void testAltReleaseDeploymentRepository(DeployMojo mojo) throws Exception {
mavenProject.setVersion("1.0");

assertEquals(
new RemoteRepository.Builder("altReleaseDeploymentRepository", "default", "http://localhost").build(),
new RemoteRepository.Builder("altReleaseDeploymentRepository", "default", "http://localhost")
.setIntent(RemoteRepository.Intent.DEPLOYMENT)
.build(),
mojo.getDeploymentRepository(
mavenProject, null, "altReleaseDeploymentRepository::http://localhost", null));
}

private void addFileToList(File file, List<String> fileList) {
if (".meta".equals(file.getName()) || ".locks".equals(file.getName())) {
// resolver 2.x bookkeeping directories
return;
}
if (!file.isDirectory()) {
fileList.add(file.getName());
} else {
Expand Down
Loading