Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

🚗 You set the rental price
🔐 Secure bookings with verified renters
📍 Track your vehicle with GPS integration
💰 Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

How to set latest P4 CL# into property?

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();
}
}
}

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x