maven get properties at compile time

How can we get Maven properties in source file at compile time



public class Main {
  private static final String artifactId = "project.artifactId";
  private static final String version = "project.version";

is it possible to hard cod in class?


You can use maven property to create java source file in generate-src directory and attach it via build helper maven plugin to the list of source folders.

You will control the contents of java file.

One way to create source java file is to use groovy maven plugin with inlining.

The question is not exactly a duplicate, but the answer I gave there explains how you can do that.

Generate a file in Maven

Need Your Help

a simple looping question

mysql loops

CREATE DEFINER = `dba`@`xx.xx.xx.3` PROCEDURE `oninjadb`.`TESTLOOPER`()

Paypal DPRA disable for this merchant message for recurring payment

php codeigniter paypal paypal-sandbox

I create test account on and in test account i set country as USA and account type is business. i have to configured recurring payment. but i still got this error

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.