public Manifest getManifest ( MavenProject project , ManifestConfiguration config ) throws ManifestException , DependencyResolutionRequiredException { // Added basic entries Manifest m = new Manifest ( ) ; Manifest . Attribute buildAttr = new Manifest . Attribute ( "Built-By" , System . getProperty ( "user.name" ) ) ; m . addConfiguredAttribute ( buildAttr ) ; Manifest . Attribute createdAttr = new Manifest . Attribute ( "Created-By" , "Apache Maven" ) ; m . addConfiguredAttribute ( createdAttr ) ; if ( config . getPackageName ( ) != null ) { Manifest . Attribute packageAttr = new Manifest . Attribute ( "Package" , config . getPackageName ( ) ) ; m . addConfiguredAttribute ( packageAttr ) ; } Manifest . Attribute buildJdkAttr = new Manifest . Attribute ( "Build-Jdk" , System . getProperty ( "java.version" ) ) ; m . addConfiguredAttribute ( buildJdkAttr ) ; if ( config . isAddClasspath ( ) ) { StringBuffer classpath = new StringBuffer ( ) ; List artifacts = project . getRuntimeClasspathElements ( ) ; String classpathPrefix = config . getClasspathPrefix ( ) ; for ( Iterator iter = artifacts . iterator ( ) ; iter . hasNext ( ) ; ) { File f = new File ( ( String ) iter . next ( ) ) ; if ( f . isFile ( ) ) { if ( classpath . length ( ) > 0 ) { classpath . append ( " " ) ; } classpath . append ( classpathPrefix ) ; classpath . append ( f . getName ( ) ) ; } } if ( classpath . length ( ) > 0 ) { Manifest . Attribute classpathAttr = new Manifest . Attribute ( "Class-Path" , classpath . toString ( ) ) ; m . addConfiguredAttribute ( classpathAttr ) ; } } String mainClass = config . getMainClass ( ) ; if ( mainClass != null && ! "" . equals ( mainClass ) ) { Manifest . Attribute mainClassAttr = new Manifest . Attribute ( "Main-Class" , mainClass ) ; m . addConfiguredAttribute ( mainClassAttr ) ; } return m ; }
Return a pre - configured manifest