简体   繁体   中英

Buildnumber maven plugin returns null

My greetings!

I have worked out really a ton of documentation, but still I get the same error :( I use Buildnumber maven plugin to get the svn version, but it returns null all of the time.

Here is the pom:

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

...

    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <properties>
            <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
            <build.timestamp>${maven.build.timestamp}</build.timestamp>
        </properties>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix>lib/</classpathPrefix>
                <mainClass>com.*.main.Main</mainClass>
            </manifest>
            <manifestEntries>
                <Implementation-Build>${buildNumber}</Implementation-Build>
                <build-timestamp>${maven.build.timestamp}</build-timestamp>
            </manifestEntries>
        </archive>
    </configuration>
</plugin>

Also, I have a Tortoise svn configured in my path and all of the requirements are done, that are noted in the official documentation. The builds, cleans, installs are all successful, but still SVN version is NULL.

I would really appreciate your help, I've spent like several hours making this thing to work...

EDIT - my scm config stub

<scm>
    <connection>scm:svn:http://none</connection>
        <developerConnection>scm:svn:https://none</developerConnection>
    <url>scm:svn:https://none</url>
</scm>

I tried you configuration and I didn't find any direct problems except from a few configuration issues.

First of all the <properties/> section you have in the <configuration/> part of the maven-jar-plugin does not belong there. See here how they should be used.

Then you should tell the fully qualified class for the <mainClass/> tag. The asterisk won't work.

When it comes to the scm part you'll have to have the <scm/> tags added to your pom.xml as well as a command line svn client.

This is the META-INF/MANIFEST.MF created when I ran mvn install with your config:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: maba
Build-Jdk: 1.7.0_07
Main-Class: com.*.main.Main
Implementation-Build: 8
build-timestamp: 2012-10-30 09:09
Class-Path: lib/log4j-1.2.14.jar

As you can see I didn't get NULL value for the Implementation-Build . As stated earlier the Main-Class: com.*.main.Main is not going to work either.

In order to be able to help you more you will need to post some more information, like the <scm/> tag for example.

The problem was that TortoiseSVN was not in my path. So I had to install something like SilkSVN, so I would be able to use its' libs in the system path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM