Slide 1
Excellent Education Program
Innovative Methods of Teaching

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient.

Slide 2
Learning Through Play
Devoted to the Early Education

Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Slide 2
Learning Through Play
Devoted to the Early Education

Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Slide 2
Learning Through Play
Devoted to the Early Education

Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Slide 2
Learning Through Play
Devoted to the Early Education

Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Slide 3
Learning Through Play
Find a Class for your Children

Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis.

previous arrow
next arrow

How to set latest P4 CL# into property?

Spread the Knowledge

tpatil created the topic: How to set latest P4 CL# into property?
We have CI setup using bamboo, P4 & maven. When I trigger the build from bamboo it gives me the CL# on which the build is done on build results page.

How can I get this value/property in pom.xml? I want to add to this CL# to MANIFEST.MF file.

Thanks,
-Tushar

How to set latest P4 CL# into property?
This may serve your ur purpose…
p4 changes -s submitted -m1

plz refer following articles as well

stackoverflow.com/questions/47007/determ…ynced-to-in-perforce
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

tpatil replied the topic: Re:How to set latest P4 CL# into property?
/**
*Usage in pon.xml
* * test.maven
* maven-p4-plugin
*
*
*
* p4changes
*

*
* //depot/ABC/2/X/...
*

*

*

*
*
* Goal which touches a timestamp file.
*
* @goal p4changes
*
* @phase process-sources
*/
public class P4RevisionMojo extends AbstractMojo {

private Process p;
private Properties prop;
private MavenProject project;
/**
* @parameter expression="${p4.url}" default-value="./..."
* @required
* @since 1.0
*/
private String suffix;
/**
* @parameter expression="${p4.port}" default-value="${env.P4PORT}"
* @optional
* @since 1.0
*/
private String p4port;
/**
* @parameter expression="${p4.client}" default-value="${env.P4CLIENT}"
* @optional
* @since 1.0
*/
private String p4client;
/**
* @parameter expression="${p4.user}" default-value="${env.P4USER}"
* @optional
* @since 1.0
*/
private String p4user;
/**
* @parameter expression="${p4.passwd}" default-value="${env.P4PASSWD}"
* @optional
* @since 1.0
*/
private String p4passwd;

public void execute() throws MojoExecutionException {
try {
String cmd = "p4 changes -m 1 " + url;
this.getLog().info("Executing P4 command: " + cmd);
p = Runtime.getRuntime().exec(cmd);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = stdInput.readLine();

String property = "p4.revision";
if (suffix != null && suffix.length() > 0) {
property = property.concat("." + suffix);
}

prop.setProperty("buildtstamp", new Date().toString());
prop.setProperty(property, "000000");
while (line != null) {
String[] line_items = line.split(" ");
if (line_items.length >= 1) {
if (line_items[0].equalsIgnoreCase("Change")) {
prop.setProperty(property, line_items[1]);
this.getLog().info("P4 Revision ${" + property + "} :::: " + prop.getProperty(property));
}

}
return;
}

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

Rajesh Kumar