I've read this page quite a few times and the answer still doesn't jump out at me. If I have two Maven projects that are completely unrelated, but they use the same property name - how do I override this property's value for one project, but not for the other?
In other words, I want "jdbc.url" to have "localhost" for most projects on my system. And in the SVN version of this other project, I have "localhost". However, because I need to connect to a Windows/SQL Server box for this one project, I need to change <jdbc.url> to have "xpboxname" instead of localhost. If I use any sort of system properties, that applies to all projects. If I modify the pom.xml, that changes things for everyone (which doesn't need to happen because I'm on the only one on a Mac). I'm all for a workaround, but the only two options I see right now are: 1. Comment out the <activeByDefault> setting in pom.xml when I want to work on other projects (not the one that needs XP). 2. Change /etc/hosts so localhost resolves to my XP box. Thanks for any advice, Matt Wayne Fay wrote: > > It might be useful to review this documentation to make sure you're > doing it "the one true way". ;-) > > http://maven.apache.org/guides/introduction/introduction-to-profiles.html > > Wayne > > On 3/12/07, mraible <[EMAIL PROTECTED]> wrote: >> >> Don't worry - I am doing things "The Maven Way" with properties in the >> root >> pom.xml. However, for this particular application, I need to override a >> property in settings.xml (I'm on a Mac and need to connect to a SQL >> Server >> instance not on "localhost"). The problem is, I have another application >> that uses the same property name (this can't be that rare, can it?). So >> when >> I override it in settings.xml, it overrides all my projects that use that >> property name. >> >> Matt >> >> >> >> Wayne Fay wrote: >> > >> > You are really not encouraged to use application-specific properties >> > in a settings.xml file, as your builds will not be portable. Instead, >> > these kinds of properties should be placed directly in the pom (parent >> > or children as appropriate) of the project you are working on. >> > >> > I use a similar process for our Ant builds, with project-specific >> > properties in my user home loaded first, then all-projects properties, >> > etc. I'm pretty sure this is a common pattern across Ant users. >> > >> > Wayne >> > >> > On 3/12/07, mraible <[EMAIL PROTECTED]> wrote: >> >> >> >> Since there's been no answers to this question, I'll assume the answer >> is >> >> "No, it's not possible to use settings.xml to have >> application-specific >> >> properties." >> >> >> >> Matt >> >> >> >> >> >> mraible wrote: >> >> > >> >> > I have a number of properties for database settings in my root >> pom.xml: >> >> > >> >> > <!-- Database settings --> >> >> > >> >> > >> >> >> <dbunit.dataTypeFactoryName>org.dbunit.dataset.datatype.DefaultDataTypeFactory</dbunit.dataTypeFactoryName> >> >> > <dbunit.operation.type>CLEAN_INSERT</dbunit.operation.type> >> >> > >> >> > >> >> >> <hibernate.dialect>org.hibernate.dialect.MySQLInnoDBDialect</hibernate.dialect> >> >> > <jdbc.groupId>mysql</jdbc.groupId> >> >> > <jdbc.artifactId>mysql-connector-java</jdbc.artifactId> >> >> > <jdbc.version>5.0.3</jdbc.version> >> >> > >> >> <jdbc.driverClassName>com.mysql.jdbc.Driver</jdbc.driverClassName> >> >> > >> >> > >> >> >> <jdbc.url><![CDATA[jdbc:mysql://localhost/tutorial?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]]></jdbc.url> >> >> > <jdbc.username>root</jdbc.username> >> >> > <jdbc.password></jdbc.password> >> >> > >> >> > This works great when I have a single project. However, I've >> started >> >> to >> >> > develop two applications with this setup, and I need to locally >> >> override >> >> > the jdbc.url for one of my projects. Is it possible to do this on >> an >> >> > application-specific basis w/o affecting both applications. AFAIK, >> >> > settings.xml doesn't have anything fancy like (does it?): >> >> > >> >> > <activation> >> >> > <property> >> >> > <name>${pom.artifactId}</name> >> >> > <value>projecttoactivatefor</value> >> >> > </property> >> >> > </activation> >> >> > >> >> > With Ant, I was able to accomplish this using: >> >> > >> >> > <!-- Load user overrides --> >> >> > <property >> >> file="${user.home}/.${ant.project.name}-build.properties"/> >> >> > <property file="${user.home}/.build.properties"/> >> >> > <property file="build.properties"/> >> >> > >> >> > Thanks, >> >> > >> >> > Matt >> >> > >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Is-it-possible-to-have-application-specific-properties-in-settings.xml--tf3363611s177.html#a9441555 >> >> Sent from the Maven - Users mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Is-it-possible-to-have-application-specific-properties-in-settings.xml--tf3363611s177.html#a9444290 >> Sent from the Maven - Users mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Is-it-possible-to-have-application-specific-properties-in-settings.xml--tf3363611s177.html#a9444655 Sent from the Maven - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
