Not sure but I think the mechanism extension does not work for SNAPSHOT versions. Try to install a non SNAPSHOT version in your local maven repository. I think I have already faced the same in the past while producing with my own extension https://github.com/jgitver/jgitver-maven-plugin
Hope it helps. Matthieu On Fri, Oct 26, 2018 at 7:39 AM J. Lewis Muir <[email protected]> wrote: > Hello, all! > > I'm trying to use the EL Profile Activation Maven Extension > > https://github.com/kpiwko/el-profile-activator-extension > > to activate a profile when the foo_env system property is either not > set, or set to "development". I'm using the "help:active-profiles" goal > of the Maven Help plugin and the "validate" phase to test whether or not > a profile is active. > > The extension works when I install it in > > <maven-home>/lib/ext > > and it works when I specify it on the command line with > > -Dmaven.ext.class.path=<paths-to-extension-jars> > > but it does *not* work when I put it in the project's > > .mvn/extensions.xml > > Does anyone know why?! > > This is Maven 3.5.4, the latest Git snapshot of EL Profile Activation > Maven Extension, and MVEL 2.4.2.Final. > > The el-profile-activator-extension artifact is not published in the > Central Repository, but I installed it into my local repository (i.e., > ~/.m2/repository) with > > git clone https://github.com/kpiwko/el-profile-activator-extension.git > cd el-profile-activator-extension > : JAVA_HOME has been set to a Java 8 SDK to compile > mvn install > > That should be fine, right? My local repository will be searched first > for any artifacts listed in extensions.xml, and I don't get a warning > nor error about it not being found, so my understanding is that this is > OK. > > For the case where the extension does not work, I have a test-01 project > directory containing the following pom.xml file > > <?xml version="1.0" encoding="UTF-8"?> > <project xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd"> > <modelVersion>4.0.0</modelVersion> > <groupId>org.example.foo</groupId> > <artifactId>foo</artifactId> > <version>1.0.0</version> > <packaging>pom</packaging> > <profiles> > <profile> > <id>foo_env-development</id> > <activation> > <property> > <name>mvel</name> > <value>(!isdef foo_env) || (isdef foo_env && foo_env > == "development")</value> > </property> > </activation> > </profile> > </profiles> > </project> > > and the following .mvn/extensions.xml file > > <extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 > http://maven.apache.org/xsd/core-extensions-1.0.0.xsd"> > <extension> > <groupId>com.redhat.jboss.maven</groupId> > <artifactId>el-profile-activator-extension</artifactId> > <version>1.0.0-SNAPSHOT</version> > </extension> > </extensions> > > I invoke Maven like this > > mvn help:active-profiles validate > > and it shows that the foo_env-development profile is not active (i.e., > it lists no active profiles) > > The following profiles are active: > > but it should be! > > A transcript of this and with the "-X" option is attached as > > test-01-extensions-dot-xml.txt > > Removing the .mvn directory and adding > > el-profile-activator-extension-1.0.0-SNAPSHOT.jar > > and > > mvel2-2.4.2.Final.jar > > to > > <maven-home>/lib/ext > > works; i.e., it shows that the foo_env-development profile is active > > The following profiles are active: > > - foo_env-development (source: org.example.foo:foo:1.0.0) > > A transcript of this and with the "-X" option is attached as > > test-01-maven-home-lib-ext.txt > > Removing those JARs from > > <maven-home>/lib/ext > > and instead specifying them on the command line by setting the > > maven.ext.class.path > > system property works; i.e., it shows that the foo_env-development > profile is active > > The following profiles are active: > > - foo_env-development (source: org.example.foo:foo:1.0.0) > > A transcript of this and with the "-X" option is attached as > > test-01-maven-ext-class-path.txt > > Any help getting the extensions.xml case to work would be greatly > appreciated! Thank you! > > Lewis > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected]
