aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ways to highlight common steps in Maven Profiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ways to highlight common steps in Maven Profiles " Watch "Ways to highlight common steps in Maven Profiles " New topic
Author

Ways to highlight common steps in Maven Profiles

Kirill Levan
Greenhorn

Joined: Feb 28, 2013
Posts: 4
Hello!
I have POM.xml like this:


Which ways can I use to take out the common actions to avoid copy/paste?

After that, how can I identify in my Java code which profile executes now?

I need this because the code is pretty common for both profiles, I can't separate it, so I want to create some condition in my java code, where I'll be able to choose further actions according to current Profile. I've tried to use SystemProperty configuration in my pom.xml by It was unsuccessful, I wasn't able to get this property by System.getProperty(..) and also I doubt that this is a good way.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

Is it an option to create a third profile for the common code?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ways to highlight common steps in Maven Profiles
 
Similar Threads
Design Question
MVN Conditional Tests
maven profiles
URLConnection class
How to Compile source code from a different Java project using Maven