GithubHelp home page GithubHelp logo

mojohaus / buildnumber-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW
61.0 24.0 56.0 1.98 MB

BuildNumber Maven Plugin

Home Page: https://www.mojohaus.org/buildnumber-maven-plugin/

License: MIT License

Java 87.70% Shell 12.30%
maven maven-plugin java buildnumber-maven-plugin mojohaus

buildnumber-maven-plugin's Introduction

MojoHaus BuildNumber Maven Plugin

This is the buildnumber-maven-plugin.

The MIT License Maven Central Build Status

Releasing

  • Make sure gpg-agent is running.
  • subversion svn is also needed for running tests
  • Make sure all tests pass mvn clean verify -Prun-its
  • Execute mvn -B release:prepare release:perform

For publishing the site do the following:

cd target/checkout
mvn verify site site:stage scm-publish:publish-scm

buildnumber-maven-plugin's People

Contributors

andham avatar batmat avatar bentmann avatar bimargulies avatar bobsta avatar cbuschka avatar codingtony avatar dantran avatar dennisl avatar dependabot[bot] avatar ecki avatar gnembisz avatar hboutemy avatar jieryn avatar khmarbaise avatar lacostej avatar mfriedenhagen avatar mfriedenhagen-ui avatar olamy avatar pgier avatar rfscholte avatar rlaun avatar slachiewicz avatar slawekjaranowski avatar stefanbirkner avatar stefanseifert avatar tobix avatar tomerc avatar tomsaleeba avatar valery1707 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

buildnumber-maven-plugin's Issues

Don't need SCM, only want to use local file (was possible in 1.0-beta-3)

I would like still the use the local file (default buildNumber.properties).
Would like to have an option in the configuration that skips the SCM functionality and uses the local file.
This was the default behavior in 1.0-beta-1, 1.0-beta-2, 1.0-beta-3.

Reason: the one that builds the app using maven should not always have access to the SCM, but still wants to see which build attempt he is looking at.

Fails to find "https" provider !?

With the web page example config:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>buildnumber-maven-plugin</artifactId>
            <version>1.4</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>create</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <doCheck>true</doCheck>
                <doUpdate>true</doUpdate>
            </configuration>
        </plugin>

I get:

[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project aps-vertx-provider: Cannot get the revision information from the scm repository :
[ERROR] No such provider: 'https'.

Note that my git repo does not use https as protocol! It is git@...

SVN credentials are printed to log since version 1.4

When starting a maven build for a project residing on svn, the password is written in plaintext to the maven log. This is obviously a security issue. From version 1-beta-4 including version 1.3 the password is not printed to the log.

using jgit provider, buildnumber-m-p:create fails

Fix for maven-scm here: apache/maven-scm#48
I tested this fix with

        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <configuration>
          <providerImplementations>
            <git>jgit</git>
          </providerImplementations>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-jgit</artifactId>
            <version>1.9.5-SNAPSHOT</version>
          </dependency>
        </dependencies>

and it works great. Please update to maven-scm 1.9.5.

timestamp and buildNumber properties not set during deploy goal

I'm trying to use matrix parameters in my distributionManagement URL to add searchable properties to my artifacts in Artifactory, as described here. I've tested with Maven 3.2.5 and 3.3.9.

I created a test project with the org.apache.maven.archetypes:maven-archetype-quickstart archetype

Define value for property 'groupId': : com.example
Define value for property 'artifactId': : artifact
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'package':  com.example: :
Confirm properties configuration:
groupId: com.example
artifactId: artifact
version: 1.0-SNAPSHOT
package: com.example
 Y: : y

And added scm, distributionManagement, and buildnumber-maven-plugin to the pom.

    <scm>
        <connection>scm:git:file:///d01/sandboxes/jgeorgeson/git/artifact.git</connection>
    </scm>

    <distributionManagement>
        <repository>
            <id>snapshots</id>
            <name>art.example.com-releases</name>
            <url>http://art.example.com/artifactory/test-deploy-releases;build.name=${project.artifactId};build.timestamp=${timestamp};build.number=${buildNumber}</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>art.example.com-snapshots</name>
            <url>http://art.example.com/artifactory/test-deploy-snapshots;build.name=${project.artifactId};build.timestamp=${timestamp};build.number=${buildNumber}</url>
        </snapshotRepository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <doCheck>true</doCheck>
                    <doUpdate>false</doUpdate>
                    <timestampFormat>{0,date,"yyyyMMddHHmmss"}</timestampFormat>
                    <shortRevisionLength>10</shortRevisionLength>
                </configuration>
            </plugin>
        </plugins>
    </build>

Running mvn deploy fails with unresolved properties

[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ artifact ---
Downloading: http://art.example.com/artifactory/test-deploy-snapshots;build.name=artifact;build.timestamp=${timestamp};build.number=${buildNumber}/com/example/artifact/1.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.example:artifact:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (http://art.example.com/artifactory/test-deploy-snapshots;build.name=artifact;build.timestamp=${timestamp};build.number=${buildNumber}): Illegal character in path at index 100: http://art.example.com/artifactory/test-deploy-snapshots;build.name=artifact;build.timestamp=${timestamp};build.number=${buildNumber}/com/example/artifact/1.0-SNAPSHOT/maven-metadata.xml

Notice that ${project.artifactId} was resolved in the URL. When I defined the timestamp and buildNum properties through other means, such as using -D on command-line or using ${maven.build.timestamp} as a default value for timestamp then it works ok.

Including the locale revision number for the goal hgchangeset

Hallo,
thank you for providing this nice maven plugin. I just wondered, if you could also add support for the locale revision number in mercurial? It's usually query with "hg id -n" and is an integer value, i. e. "100" or "100+". It would be great, if you could add support for this minor feature of mercurial.

I already modified the existing HgChangeSetMojo.java file and attached it to this post. So it's more or less a simple switch.
HgChangeSetMojo.txt

Local modifications are ignored if module not at git repo root level

I have a project using buildnumber-maven-plugin with a git repo. The problem is that doCheck=true does not result in a build failure when local modifications exist. After some searching and hacking I came to the conclusion that this is a bug.

I created a test project with similar setup but could not reproduce the problem at first. Then I moved the Maven module from the root level of the repo under a sub directory. This setup does reproduce the problem and matches the layout of my actual project.

See my test project at https://github.com/suniala/buildnumber-test. The first version, where doCheck=true works as expected, is available at master. The branch module-not-at-root-level contains the failing version.

Note that I am aware of #5 and noticed that removing the format did not affect the outcome with my test project.

Add support for Last Changed Date

It would be nice to support the 'last changed date' property as well. Currently only build date is available, which is suboptimal in certain scenarios. It is covered in the following (old) pull request: 8c0f414

Would it be possible to review it and integrate?

With Git SCM allow staged changes in working copy

I'm currently setting up to fail on dirty working copy. However developers are somewhat frustrated with the change and try find ways to globally disable it in their workspace. To encourage them to not disable the check, I'd like to see configuration to allow staged changes. That way their work is at least marked for commit, but they don't have to worry about amending/rebasing a commit they made just to avoid the Maven failure due to local modifications.

Parameter useLastCommittedRevision in create mojo is not working

Even when useLastCommittedRevision parameter in create mojo is set to true whole repository revision is always returned. I think it's because useLastCommittedRevision property is declared twice (first in AbstractScmMojo.java and second in CreateMojo.java). When I comment this property in CreateMojo.java then it's working.

Support git-svn

For old projects based on svn would be great to support git-svn:

The use case is:

  1. pom scm section is set to a svn url
  2. provider is set as javasvn
  3. repo is a git-svn clone
  4. Want to extract the revision number from checkout
commit 10a3ae3fc8d83532266ee1ff58694cd569935aa3 (HEAD, origin/trunk)

Author: Alberto <[email protected]>
Date: Wed Mar 7 16:11:01 2018 +0000

commit message

git-svn-id: http://svn.com@8715 2d76ea88-ba9a-4675-b1a1-0fb15de6bd4c

So here the scmVersion would be 8715

Now the result is:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.882 s
[INFO] Finished at: 2018-03-08T12:50:52+01:00
[INFO] Final Memory: 18M/224M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project myProject: Cannot get the revision information from the scm repository :
[ERROR] Exception while executing SCM command. svn: E155007: 'C:\myProject' is not a working copy

I understand the problem could be solved on scm provider, so I open too https://issues.apache.org/jira/browse/SCM-872

Support for flagging a property if local changes are present

I see there is a way to fail the plugin in presence of local changes. This is good, as it would taint the version number, but is not particularly development friendly. I either have to set doCheck to true, and developers won't be able to build until they somehow override it, or not set doCheck, and risk somebody publishing a build that has local changes in it.

It would be great if BuildNumber could set another project property that would indicate whether the build is tainted or not, so then it can be published the same way as others into the project artifacts, so it can be clearly seen whether the binary was built from a clean clone or not.

Untracked files not rejected on Git

When using buildnumber-maven-plugin 1.3, 1.4 or 1.5-SNAPSHOT (the later two from source) the git scm provider seems not to handle untracked files (marked as "??" in git status output). This means unlike the SVN provider it will not reject a dirty workspace. I have tested this on windows with mvn 3.0.5 and 3.2.5 with git executable of versions 1.9.5.github.0 and 2.6.1.windows.1. The following is the test project I used, the README.md also contains some sample output of the tests: https://github.com/ecki/buildnumber-maven-test

Here a copy of the configuration:

<configuration>
    <doCheck>true</doCheck>
    <revisionOnScmFailure>failed</revisionOnScmFailure>
    <shortRevisionLength>8</shortRevisionLength>
    <useLastCommittedRevision>true</useLastCommittedRevision>
</configuration>

Detecting the version and the branch actually works since 1.4 and detecting modified (tracked) files also works.

Buildnumber plugin does not fail on doCheck if format is specified

In the create mojo, the doCheck option is not honored if format is configured.
This can be verified by adding this to the plugin configuration in the integration test MBUILDNUM-85:

  <format>{0,date,yyyyMMdd}-{1}</format>
  <items>
    <item>timestamp</item>
    <item>scmVersion</item>
  </items>

1.4 uses native SVN instead of java impementation

I manage a top level pom for a large organization and since updating to the buildnumber-maven-plugin 1.4, users are required to have the SVN executable installed.

They generally do not because they use Eclipse.

Can this change please be reverted?

${scmBranch} is returning UNKNOW

I'm using mercruial and buildnumber-maven-plugin 1.4. And command ${scmBranch} return value UNKNOW. What i need to do to get branch name information from buildnumber-maven-plugin?
My pom.xml:

<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>2.6</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
              <manifestEntries>
                <Implementation-Build>${buildNumber}</Implementation-Build>
                <SCM-Build>${scmBranch}</SCM-Build>
              </manifestEntries>
            </archive>
          </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>1.4</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <doCheck>false</doCheck>
          <doUpdate>false</doUpdate>
          <scmBranchPropertyName>true</scmBranchPropertyName>


        </configuration>
      </plugin>

Builld fails if -Dmaven.buildNumber.doUpdate=true - tries to update from `master` instead of current branch?

So current branch is feature-branch. doCheck goes OK but doUpdate doesn't as it seems to try it on master instead of the actual current branch for no apparent reason.

[d4nirod@mac-mini:cw-server (feature-branch)]$ mvn -Dmaven.buildNumber.doCheck=true -Dmaven.buildNumber.doUpdate=true install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Ckrs 1.0
[INFO] ------------------------------------------------------------------------
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ cw-server ---
[INFO] Executing: /bin/sh -c cd '/Users/d4nirod/Documents/workspace/cw-server' && 'git' 'rev-parse' '--show-toplevel'
[INFO] Working directory: /Users/d4nirod/Documents/workspace/cw-server
[INFO] Executing: /bin/sh -c cd '/Users/d4nirod/Documents/workspace/cw-server' && 'git' 'status' '--porcelain' '.'
[INFO] Executing: /bin/sh -c cd '/Users/d4nirod/workspace/cw-server' && 'git' 'log' '-n1' '--date-order' 'master'
[INFO] Working directory: /Users/d4nirod/workspace/cw-server
[ERROR] Provider message:
[ERROR] The git-log command failed.
[ERROR] Command output:
[ERROR] fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.992 s
[INFO] Finished at: 2016-04-12T09:34:02+02:00
[INFO] Final Memory: 12M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project cw-server: Couldn't update project. Error! -> [Help 1]
[ERROR]

Option to get timestamp only once?

I'm trying to use this plugin with a multi-module maven project, with the constraint that all submodules should have the same buildNumber. I have already set up a formatted buildNumber which is made of the timestamp and the Git revision hash. This works fine, but the timestamp is generated new for every module, resulting in different buildNumber for the submodules.

Is there any reason why getRevisionOnlyOnce only affects the revision and not the timestamp? Or am I missing something?

Standardize MOJOs on SimpleDateFormat for timestampFormat

I found it quite confusing to have a common parameter name shared between MOJOs being implemented in different ways. I prefer the SimpleDateFormat and you already have a utility class that can be called uniformly across MOJOs. I will be submitting a PR to accomplish the following:

  1. Update CreateMojo to use Utils.createTimestamp()
  2. Check for usage of java.text.MessageFormat value in timestampFormat and warn of it's deprecation while regex parsing out the format for backwards-compatibility
  3. Update all the IT projects except basic-it so that the warning and backwards-compatibility are validated.

ConcurrentModificationException in create goal when running in parallel

When running with -T 8 I'm sometimes getting:

Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.3:create (default) on project simple_ui: Cannot get the revision information from the scm repository :
Exception while executing SCM command. ConcurrentModificationException

Here is the relevant console output:


03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates && git rev-parse --verify HEAD
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/simple_ui && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/simple_ui && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/simple_ui && git rev-parse --verify HEAD
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/simple_ui
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/simple_ui
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools && git rev-parse --verify HEAD
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/simple_ui
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent && git rev-parse --verify HEAD
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent
03:01:49 [INFO] Storing buildNumber: f8ed6e10987e79561b3a7cadb0908e02560935f9 at timestamp: 1482544913778
03:01:49 [INFO] Storing buildNumber: f8ed6e10987e79561b3a7cadb0908e02560935f9 at timestamp: 1482544913779
03:01:49 [INFO] Storing buildNumber: f8ed6e10987e79561b3a7cadb0908e02560935f9 at timestamp: 1482544913777
03:01:49 [WARNING] Cannot get the branch information from the git repository: 
03:01:49 Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref
03:01:49 
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates && git rev-parse --verify HEAD
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/email_templates
03:01:49 [WARNING] Cannot get the branch information from the git repository: 
03:01:49 Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref
03:01:49 
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent && git rev-parse --verify HEAD
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/build-parent
03:01:49 [INFO] Storing buildScmBranch: UNKNOWN
03:01:49 [INFO] 
03:01:49 [INFO] --- maven-antrun-plugin:1.8:run (check-email-templates) @ email_templates ---
03:01:49 [JENKINS] Archiving disabled
03:01:49 [WARNING] Cannot get the branch information from the git repository: 
03:01:49 Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref
03:01:49 
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools && git rev-parse --verify HEAD
03:01:49 [INFO] Executing: /bin/sh -c cd /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools && git rev-parse --verify HEAD
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools
03:01:49 [INFO] Working directory: /home/jenkins-slave/workspace/acme_Gitlab_func/acme/module/dev-tools
03:01:49 [INFO] Storing buildScmBranch: UNKNOWN
03:01:49 [INFO] Storing buildScmBranch: UNKNOWN

Timestamp generation is not thread safe

Example project structure (attached in zip)

  • buildnumbertest
    -- A
    -- B
    -- C
    -- D
    -- E

Here, submodules A,B,C,D,E will try to generate the timestamp concurrently, which will result in different timestamps assigned.
In this scenario the root project does not attempt to generate the timestamp.

Run the follwing command on the root:
mvn install -T4 -X -pl A,B,C,D,E | tee out.txt

then:

cat out.txt | grep "Storing timestamp"

Outputs (which shows that different projects may have different plugins assigned):

[DEBUG] Storing timestamp property: api.test.datetime 09.150811.939
[DEBUG] Storing timestamp property: api.test.datetime 09.150811.955

Note: this is not a deterministic output. Occasionally there is only one timestamp generated.

Investigation:

In the org.codehaus.mojo.build.CreateTimestampMojo class, the block of code, is not synchronized:

    if ( timestampString != null )
    {
        getLog().debug( "Using previously created timestamp." );
        return;
    }

    timestampString = Utils.createTimestamp( timestampFormat, timezone );

    getLog().debug( "Storing timestamp property: " + timestampPropertyName + " " + timestampString );

    for ( MavenProject project : session.getProjectDependencyGraph().getSort

buildnumbertest.zip
edProjects() )
{
getLog().debug( "Storing timestamp property in project " + project.getId() );
project.getProperties().setProperty( timestampPropertyName, timestampString );
}

Clear password show in command line

buildnumber-maven-plugin version 1.4 under Netbeans 8 on OS X. The command line show both clear password and the substitution string "*****". Debugging plugin one understands that cryptPassword
fail to find the correct space character because of presence of arguments quote delimiters (').

Maybe this code

String beforePassword = clString.substring( 0, pos + "--password ".length() );
String afterPassword = clString.substring( pos + "--password ".length() );

must take into account the platform specific command line, especially the presence of quote delimiters.

Because the code is in org.apache.maven.scm.provider.svn.svnexe.command there is a solution?

Create goal in version 1.4 fails if Git is not available

I do not have Git in my classpath but SVN. But the build fails for version 1.4. Switching to 1.3 works as expected.

[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (create-buildnumber-of-git-revision) on project blueprint-parent: Cannot get the revision information from the scm repository :[ERROR] Exception while executing SCM command. Error while executing command. Er
ror while executing process. Cannot run program "git" (in directory "F:\LC3Upgrade\LC3\blueprint-parent"): CreateProcess error=2, The system cannot find the file specified

Implement "Last Changed Rev" instead of "Revision" field

It seems that the current notion of picking the revision information is the Revision field from the svn info information. However, I would need to have the Last Changed Rev information field. After searching the web and reading the documentation, I have not found a way to obtain this field. Is there a way, and if not, would it be possible to implement this (along the line of 8c0f414)?

Example output from svn info:

Path: .
Working Copy Root Path: /<...>/dev/projects/proj-A
URL: http://example.com/svn/<...>/trunk
Relative URL: ^/<...>/trunk
Repository Root: http://example.com/svn/
Repository UUID: 8104d0a4-ed15-438a-b3ec-15d70441338f
Revision: 78855
Node Kind: directory
Schedule: normal
Last Changed Author: the.swede
Last Changed Rev: 78847
Last Changed Date: 2017-06-28 09:43:58 +0900 (Wed, 28 Jun 2017)

In the above excerpt one can spot that the overall company-wide svn revision counter field is at 78855, while the individual project's svn counter for the last change is at 78847. This is the one I would need.

Quite related is the following question on StackOverflow.

Revision found on update is overwritten

I am trying to use the buildnumber-maven-plugin (v1.4) with a Perforce repository. I am getting the following logged messages:

[INFO] Got a revision during update: 4079887
[INFO] Storing buildNumber: null at timestamp: 1506951375881

The CreateMojo.update() methodis discovering the correct revision number (1st log message). However, after it is found an unconditional call to getRevision() is made that wipes it out because it calls the info() method on the repository provider (which the perforce provider does not implement and simply returns null). Once the revision is discovered (on update()), why not just return it?

Maven fails to parse the plugin on version 1.4

I've been struggling to get the buildnumber plugin working in my maven project. At first, maven wouldn't download it from the maven2 repository. Then it somehow got scrambled (sha1 sum did not match). I manually downloaded it an placed it and the checksum in my .m2 folder under the appropriate path. However, maven still complains about the plugin saying it doesn't have a pom and the plugin descriptor is bad (see below clean build output). Any help would be appreciated.

I'm building on a mac 10.11.6 (El Capitan).

$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Project 0.1
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.codehause.mojo:buildnumber-maven-plugin:jar:1.4 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.161 s
[INFO] Finished at: 2017-01-09T08:34:41-07:00
[INFO] Final Memory: 8M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to parse plugin descriptor for org.codehause.mojo:buildnumber-maven-plugin:1.4 (/Users/drewed/.m2/repository/org/codehause/mojo/buildnumber-maven-plugin/1.4/buildnumber-maven-plugin-1.4.jar): error in opening zip file -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginDescriptorParsingException

Invalid URL in effective POM of project

The project's POM does not define a <url> and based on how the parent POM defines a URL: http://www.mojohaus.org/${project.artifactId}, the generated URL on this project is a non-existent page.

$ mvn help:effective-pom | grep -v "^\[INFO\]" | grep -v "^Effective POMs" | grep -v "^$" | xpath -q -e "//project/url/text()"
http://www.mojohaus.org/buildnumber-maven-plugin/buildnumber-maven-plugin

While the correct URL should be: http://www.mojohaus.org/buildnumber-maven-plugin/

While this in itself is not an issue with the functioning of the project; the Maven project-info-report plugin uses the effective URL in the Project Plugin Management report. This of course causes a 404 error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.