How can I use a default value if an environment variable isn’t set for resource filtering in maven?

I’m using the profile for determining as <profiles> <profile> <activation> <activeByDefault>true</activeByDefault> <property> <name>!myproperty</name> </property> </activation> … <properties> <myproperty>some value</myproperty> </properties> </profile> … </profiles> Please note The activeByDefault is set to true with purpose to enable it by default. The !myproperty means this property is missing or not existed. If the myproperty is not existed, just … Read more

Maven build failed due to JDT dependencies – No versions available for org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0)

EDIT: The issue is known by the project team and tracked as eclipse-equinox/equinox.bundles#54 on GitHub. The dependency: <groupId>org.eclipse.platform</groupId> <artifactId>org.eclipse.equinox.preferences</artifactId> <version>3.10.0</version> Which is one of your transitive dependency, references this dependency in its dependencies list: <dependency> <groupId>org.osgi.service</groupId> <artifactId>org.osgi.service.prefs</artifactId> <version>[1.1.0,1.2.0)</version> </dependency> Source: org.eclipse.equinox.preferences-3.10.0.pom on maven central. It is a mistake. As Maven tells you, this does not … Read more

How to include system dependencies in war built using maven

Let me try to summarise the options I tried : <packagingIncludes>${java.home}/lib/jfxrt.jar</packagingIncludes> This doesn’t work! Also, only having the jar name, excludes everything else, so if you are willing to try then try <packagingIncludes>${java.home}/lib/jfxrt.jar,**/*</packagingIncludes> Jatin’s answer seemed a bit complex and I tried going through the POM again & again to figure out where exactly were … Read more

Failed to deploy artifacts: Could not find artifact

Have you tried to add the server in your settings.xml file? The default settings xml is located in your ~/.m2/ directory. Should contain something like that: <servers> <server> <id>my-internal-nexus-repo</id> <username>yourUserName</username> <password>yourPassword</password> </server> </servers> Here is a link to the http://maven.apache.org/settings.html maven doc for adding servers. One other thing which might be a shot in the … Read more

How to run Tomcat 7 using Maven 2 Tomcat plugin?

This works for me: http://tomcat.apache.org/maven-plugin-2.1/ With this plugin config: <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <path>/</path> </configuration> </plugin> And running with mvn clean install tomcat7:run (Please note that tomcat7:run, not tomcat:run.) Plugin documentation is here: http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/plugin-info.html For example, the default value of additionalConfigFilesDir is ${basedir}/src/main/tomcatconf, so if you put your configs into this directory it will … Read more

How to run Maven from Java?

A simple invocation API : maven-invoker. Project documentation : http://maven.apache.org/shared/maven-invoker/ Usage : http://maven.apache.org/shared/maven-invoker/usage.html InvocationRequest request = new DefaultInvocationRequest(); request.setPomFile( new File( “/path/to/pom.xml” ) ); request.setGoals( Arrays.asList( “clean”, “install” ) ); Invoker invoker = new DefaultInvoker(); invoker.execute( request );