提交 bd43c389 编写于 作者: K kohsuke

modified to record version number of MavenModule


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7878 71c3de6d-444a-0410-be80-ed276b4c234a
上级 02c72cf7
...@@ -288,7 +288,7 @@ ...@@ -288,7 +288,7 @@
<dependency> <dependency>
<groupId>org.kohsuke.stapler</groupId> <groupId>org.kohsuke.stapler</groupId>
<artifactId>stapler</artifactId> <artifactId>stapler</artifactId>
<version>1.65</version> <version>1.66-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<!-- until the next rev of stapler picks up localizer 1.5 --> <!-- until the next rev of stapler picks up localizer 1.5 -->
......
...@@ -47,6 +47,15 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui ...@@ -47,6 +47,15 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui
*/ */
private String displayName; private String displayName;
/**
* Version number of this module as of fhe last build, taken from {@link MavenProject#getVersion()}.
*
* This field can be null if Hudson loaded old data
* that didn't record this information, so that situation
* needs to be handled gracefully.
*/
private String version;
private transient ModuleName moduleName; private transient ModuleName moduleName;
private String relativePath; private String relativePath;
...@@ -114,6 +123,7 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui ...@@ -114,6 +123,7 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui
*/ */
/*package*/ final void reconfigure(PomInfo pom) { /*package*/ final void reconfigure(PomInfo pom) {
this.displayName = pom.displayName; this.displayName = pom.displayName;
this.version = pom.version;
this.relativePath = pom.relativePath; this.relativePath = pom.relativePath;
this.dependencies = pom.dependencies; this.dependencies = pom.dependencies;
this.children = pom.children; this.children = pom.children;
...@@ -158,6 +168,18 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui ...@@ -158,6 +168,18 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui
return relativePath; return relativePath;
} }
/**
* Gets the version number in Maven POM as of the last build.
*
* @return
* This method can return null if Hudson loaded old data
* that didn't record this information, so that situation
* needs to be handled gracefully.
*/
public String getVersion() {
return version;
}
/** /**
* Gets the list of goals to execute for this module. * Gets the list of goals to execute for this module.
*/ */
......
...@@ -43,6 +43,13 @@ final class PomInfo implements Serializable { ...@@ -43,6 +43,13 @@ final class PomInfo implements Serializable {
*/ */
public final String relativePath; public final String relativePath;
/**
* Version number taken from POM.
*
* @see MavenProject#getVersion()
*/
public final String version;
/** /**
* Dependency of this project. * Dependency of this project.
* *
...@@ -69,6 +76,7 @@ final class PomInfo implements Serializable { ...@@ -69,6 +76,7 @@ final class PomInfo implements Serializable {
public PomInfo(MavenProject project, PomInfo parent, String relPath) { public PomInfo(MavenProject project, PomInfo parent, String relPath) {
this.name = new ModuleName(project); this.name = new ModuleName(project);
this.version = project.getVersion();
this.displayName = project.getName(); this.displayName = project.getName();
this.defaultGoal = project.getDefaultGoal(); this.defaultGoal = project.getDefaultGoal();
this.relativePath = relPath; this.relativePath = relPath;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册