• Intro Headers Instructions Macros Commands
  • Fork me on GitHub
    • Introduction
    • How to install bnd
    • Guided Tour
    • Guided Tour Workspace & Projects
    • Concepts
    • Best practices
    • Build
    • Project Setup
    • Generating JARs
    • Versioning
    • Baselining
    • Service Components
    • Metatype
    • Contracts
    • Bundle Annotations
    • Accessor Properties
    • SPI Annotations
    • Resolving Dependencies
    • Launching
    • Startlevels
    • Testing
    • Testing with Launchpad
    • Packaging Applications
    • JPMS Libraries
    • Wrapping Libraries to OSGi Bundles
    • Generating Documentation
    • Commands
    • For Developers
    • Tips for Windows users
    • Tools bound to bnd
    • Headers
    • Instruction Reference
    • Instruction Index
    • Macro Reference
    • Macro Index
    • Plugins
    • External Plugins
    • Settings
    • Errors
    • Warnings
    • Frequently Asked Questions
  • Bundle-Version ::= version

    The version of the bundle. If no such header is provided, a version of 0 will be set.

    	verifyHeader(Constants.BUNDLE_VERSION, VERSION, true);
    		public final static Pattern	VERSION							= Pattern.compile(VERSION_STRING);
    		public final static String	VERSION_STRING					= "[0-9]{1,9}(\\.[0-9]{1,9}(\\.[0-9]{1,9}(\\.[0-9A-Za-z_-]+)?)?)?";
    	
    	
    		/**
     * Intercept the call to analyze and cleanup versions after we have analyzed
     * the setup. We do not want to cleanup if we are going to verify.
     */
    
    @Override
    public void analyze() throws Exception {
    	super.analyze();
    	cleanupVersion(getImports(), null);
    	cleanupVersion(getExports(), getVersion());
    	String version = getProperty(BUNDLE_VERSION);
    	if (version != null) {
    		version = cleanupVersion(version);
    		if (version.endsWith(".SNAPSHOT")) {
    			version = version.replaceAll("SNAPSHOT$", getProperty(SNAPSHOT, "SNAPSHOT"));
    		}
    		setProperty(BUNDLE_VERSION, version);
    	}
    }
    	
    	
    				if (main.getValue(BUNDLE_VERSION) == null)
    			main.putValue(BUNDLE_VERSION, "0");
    
    • GitHub