public Gav()

in indexer-core/src/main/java/org/apache/maven/index/artifact/Gav.java [87:147]


    public Gav(
            String groupId,
            String artifactId,
            String version,
            String classifier,
            String extension,
            Integer snapshotBuildNumber,
            Long snapshotTimeStamp,
            String name,
            boolean hash,
            HashType hashType,
            boolean signature,
            SignatureType signatureType) {
        this.groupId = groupId;
        this.artifactId = artifactId;
        this.version = version;
        this.snapshot = VersionUtils.isSnapshot(version);

        if (!snapshot) {
            this.baseVersion = null;
        } else {
            if (version.contains("SNAPSHOT")) {
                // this is not a timestamped version
                this.baseVersion = null;
            } else {
                // this is a timestamped version (verified against pattern, see above)
                // we have XXXXXX-YYYYMMDD.HHMMSS-B
                // but XXXXXX may contain "-" too!

                // if ( new DefaultNexusEnforcer().isStrict() )
                // {
                // this.baseVersion = version.substring( 0, version.lastIndexOf( '-' ) );
                // this.baseVersion = baseVersion.substring( 0, baseVersion.lastIndexOf( '-' ) ) + "-SNAPSHOT";
                // }
                // also there may be no XXXXXX (i.e. when version is strictly named SNAPSHOT
                // BUT this is not the proper scheme, we will simply loosen up here if requested
                // else
                // {
                // trim the part of 'YYYYMMDD.HHMMSS-BN
                String tempBaseVersion = version.substring(0, version.lastIndexOf('-'));
                tempBaseVersion = tempBaseVersion.substring(0, tempBaseVersion.length() - 15);

                if (tempBaseVersion.length() > 0) {
                    this.baseVersion = tempBaseVersion + "SNAPSHOT";
                } else {
                    this.baseVersion = "SNAPSHOT";
                }
                // }
            }
        }

        this.classifier = classifier;
        this.extension = extension;
        this.snapshotBuildNumber = snapshotBuildNumber;
        this.snapshotTimeStamp = snapshotTimeStamp;
        this.name = name;
        this.hash = hash;
        this.hashType = hashType;
        this.signature = signature;
        this.signatureType = signatureType;
    }