@@ -276,6 +276,41 @@ public void testDeployIfArtifactIsNotJar() throws Exception {
276
276
assertTrue (file .exists ());
277
277
}
278
278
279
+ public void testDeployFileIfPackagingIsSet () throws Exception {
280
+ File testPom = new File (getBasedir (), "target/test-classes/unit/deploy-file-packaging/plugin-config.xml" );
281
+ mojo = (DeployFileMojo ) lookupMojo ("deploy-file" , testPom );
282
+
283
+ openMocks = MockitoAnnotations .openMocks (this );
284
+
285
+ assertNotNull (mojo );
286
+
287
+ DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession ();
288
+ repositorySession .setLocalRepositoryManager (
289
+ new SimpleLocalRepositoryManagerFactory (new DefaultLocalPathComposer ())
290
+ .newInstance (repositorySession , new LocalRepository (LOCAL_REPO )));
291
+ when (session .getRepositorySession ()).thenReturn (repositorySession );
292
+
293
+ String packaging = (String ) getVariableValueFromObject (mojo , "packaging" );
294
+
295
+ String groupId = (String ) getVariableValueFromObject (mojo , "groupId" );
296
+
297
+ String artifactId = (String ) getVariableValueFromObject (mojo , "artifactId" );
298
+
299
+ String version = (String ) getVariableValueFromObject (mojo , "version" );
300
+
301
+ assertEquals ("differentpackaging" , packaging );
302
+
303
+ mojo .execute ();
304
+
305
+ File deployedArtifact = new File (
306
+ remoteRepo ,
307
+ "deploy-file-packaging/" + groupId .replace ('.' , '/' ) + "/"
308
+ + artifactId + "/" + version + "/" + artifactId + "-"
309
+ + version + "." + packaging );
310
+
311
+ assertTrue (deployedArtifact .exists ());
312
+ }
313
+
279
314
private void addFileToList (File file , List <String > fileList ) {
280
315
if (!file .isDirectory ()) {
281
316
fileList .add (file .getName ());
0 commit comments