1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  package org.apache.felix.bundleplugin;
20  
21  
22  import java.io.File;
23  import java.io.FileNotFoundException;
24  import java.io.IOException;
25  import java.util.Map;
26  import java.util.Properties;
27  
28  import org.apache.maven.plugin.MojoExecutionException;
29  import org.apache.maven.plugin.MojoFailureException;
30  import org.apache.maven.project.MavenProject;
31  
32  import aQute.bnd.osgi.Jar;
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  public class InstructionsPlugin extends BundlePlugin
43  {
44      protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
45          throws MojoExecutionException
46      {
47          if ( dumpInstructions == null )
48          {
49              dumpInstructions = new File( getBuildDirectory(), "instructions.bnd" );
50          }
51  
52          try
53          {
54              addMavenInstructions( project, getOSGiBuilder( project, instructions, properties, classpath ) );
55          }
56          catch ( FileNotFoundException e )
57          {
58              throw new MojoExecutionException( "Cannot find " + e.getMessage(), e );
59          }
60          catch ( IOException e )
61          {
62              throw new MojoExecutionException( "Error trying to generate instructions", e );
63          }
64          catch ( MojoFailureException e )
65          {
66              getLog().error( e.getLocalizedMessage() );
67              throw new MojoExecutionException( "Error(s) found in instructions", e );
68          }
69          catch ( Exception e )
70          {
71              getLog().error( "An internal error occurred", e );
72              throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e );
73          }
74      }
75  }