Hi Andreas, > Is this by design, i.e., is ${settings.offline} different from, > say, a property ${my.offline} that I activate with -D?
For better or for worse, Maven profiles cannot be activated based on Maven properties, only based on Java system properties and/or environment variables. That is, anything you pass in via -Dfoo.bar can be used for activation, but all those properties you put in the <properties> section of your POM, or in settings.xml, cannot trigger profiles. The Maven offline property is one of the latter, not the former. > does there exist a different way to achieve the same thing, > i.e., activate a profile when -offline? After 30+ minutes of thinking about this and trying things and grepping Maven source code, I do not think what you want to do is obviously possible. Pragmatically, I thought maybe you could enable offline mode using a profile in your settings.xml activated on an environment variable, but you cannot toggle the offline setting in such a profile, because <offline> is a toplevel element (i.e., not declared beneath <properties>). The greater design issue is that Maven needs to know whether it is offline mode before it starts doing things like resolving parent POMs. But that resolution is necessary in order to fully interpolate the POM and hence know which profiles are activated. Regards, Curtis On Thu, Feb 5, 2015 at 7:43 AM, Andreas Sewe < s...@st.informatik.tu-darmstadt.de> wrote: > Hi, > > sometimes it's useful to configure a Maven plugin depending on whether > the build runs in online or offline mode (-offline command-line option). > Now, using > > mvn help:effective-settings -offline > > shows that ${settings.offline} == true. Alas, I cannot get the following > profile to activate: > > <profile> > <id>offline</id> > <activation> > <property> > <name>settings.offline</name> > <value>true</value> > </property> > </activation> > </profiles> > > Is this by design, i.e., is ${settings.offline} different from, say, a > property ${my.offline} that I activate with -D? Or is this a bug? > > Last but not least, does there exist a different way to achieve the same > thing, i.e., activate a profile when -offline? > > Best wishes, > > Andreas > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >