Reputation: 1366
I am developing a maven plugin. It is used at build time by other projects. This plugin uses the username and password in order to connect to an svn repository/server. This is part of this maven plugin's pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<useReleaseProfile>true</useReleaseProfile>
<releaseProfiles>complete</releaseProfiles>
<username>${username}</username>
<password>${password}</password>
</configuration>
</plugin>
I need to get the values of username and password dynamically when the plugin is running (In other words when other projects are being built). How can I do that?
Thanks!
Edit:
When other users build their project with this plugin, They don't pass their username/password through command line. (Like: -DuserName=userNameVal). But the plugin works fine and can connect to svn repository/server using their username and password. The problem is that I don't understand how this plugin get these values.
And one more thing: I need to get values in my java code. Something like this:
String username = getUserName();
Upvotes: 1
Views: 969
Reputation: 5649
Pass the values through commandline like below:-
mvn install "-DuserName=userNameValue"
Then in your pom.xml you can do like below:-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<useReleaseProfile>true</useReleaseProfile>
<releaseProfiles>complete</releaseProfiles>
**<username>${userName}</username>**
<password>${password}</password>
</configuration>
</plugin>
Upvotes: 1