@@ -346,10 +346,13 @@ public void execute() throws MojoExecutionException, MojoFailureException {
346346 filter (inputFile , outputFile );
347347 getLog ().info ("Generation not enabled" );
348348 getLog ().info ("Attaching artifact" );
349- //projectHelper.attachArtifact(project, attachmentArtifactType, attachmentArtifactClassifier, outputFile);
350- Artifact artifact = factory .createArtifactWithClassifier (project .getGroupId (), project .getArtifactId (), project .getVersion (), attachmentArtifactType , attachmentArtifactClassifier );
351- artifact .setFile (outputFile );
352- project .setArtifact (artifact );
349+ if (project .getPackaging ().equals ("feature" )) {
350+ Artifact artifact = factory .createArtifactWithClassifier (project .getGroupId (), project .getArtifactId (), project .getVersion (), attachmentArtifactType , attachmentArtifactClassifier );
351+ artifact .setFile (outputFile );
352+ project .setArtifact (artifact );
353+ } else {
354+ projectHelper .attachArtifact (project , attachmentArtifactType , attachmentArtifactClassifier , outputFile );
355+ }
353356 return ;
354357 }
355358 }
@@ -364,9 +367,17 @@ public void execute() throws MojoExecutionException, MojoFailureException {
364367 try (PrintStream out = new PrintStream (new FileOutputStream (outputFile ))) {
365368 writeFeatures (out );
366369 }
367- getLog ().info ("Attaching features XML" );
368- // now lets attach it
369- projectHelper .attachArtifact (project , attachmentArtifactType , attachmentArtifactClassifier , outputFile );
370+ if (project .getPackaging ().equals ("feature" ) && enableGeneration ) {
371+ getLog ().info ("Set artifact" );
372+ Artifact artifact = factory .createArtifactWithClassifier (project .getGroupId (), project .getArtifactId (), project .getVersion (), attachmentArtifactType
373+ , FEATURE_CLASSIFIER );
374+ artifact .setFile (outputFile );
375+ project .setArtifact (artifact );
376+ } else {
377+ getLog ().info ("Attaching features XML" );
378+ // now lets attach it
379+ projectHelper .attachArtifact (project , attachmentArtifactType , attachmentArtifactClassifier , outputFile );
380+ }
370381 } else {
371382 throw new MojoExecutionException ("Could not create directory for features file: " + dir );
372383 }
0 commit comments