I'm trying to run exec-maven-plugin's exec:java goal on a simple two-module project where one module depends on the other. So far I can't find a configuration that works. Here's a boiled-down test case:
+ exec-multi-module-test/
+ pom.xml
+ module1/
+ pom.xml
+ src/
+ main/
+ java/
+ HelloPrinter.java
+ module2/
+ pom.xml
+ src/
+ main/
+ java/
+ MyMain.java
Here's the parent pom:
<?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>com.mkscrg.sandbox</groupId>
<artifactId>exec-multi-module-test</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>module1</module>
<module>module2</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
</plugin>
</plugins>
</build>
</project>
module1's pom:
<?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>
<parent>
<artifactId>exec-multi-module-test</artifactId>
<groupId>com.mkscrg.sandbox</groupId>
<version>1.0</version>
</parent>
<artifactId>module1</artifactId>
</project>
module2's pom:
4.0.0
<parent>
<artifactId>exec-multi-module-test</artifactId>
<groupId>com.mkscrg.sandbox</groupId>
<version>1.0</version>
</parent>
<artifactId>module2</artifactId>
<dependencies>
<dependency>
<groupId>com.mkscrg.sandbox</groupId>
<artifactId>module1</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
This project compiles successfully from the top, but running mvn exec:java -Dexec.mainClass=myMain fails:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] exec-multi-module-test
[INFO] module1
[INFO] module2
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building exec-multi-module-test 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) # exec-multi-module-test >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) # exec-multi-module-test <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) # exec-multi-module-test ---
[WARNING]
java.lang.ClassNotFoundException: MyMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
at java.lang.Thread.run(Thread.java:680)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] exec-multi-module-test ............................ FAILURE [0.363s]
[INFO] module1 ........................................... SKIPPED
[INFO] module2 ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.566s
[INFO] Finished at: Mon Jun 18 14:11:54 PDT 2012
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project exec-multi-module-test: An exception occured while executing the Java class. MyMain -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
What's the right way to configure this project to allow exec:java to see MyMain?
EDIT: Here's a gist if you'd like to try this yourself: https://gist.github.com/2950830
EDIT: Clarification: I know it's possible to mvn install and then either run exec:java from module2's directory or use the -pl flag from the top. However, I'd like to avoid running mvn install. It shouldn't be necessary to modify my local repository in order to run this goal in a multi-module project. Just as mvn compile "just works" with a multi-module project, so should other goals/phases.
Goals in a multi-module project, when run from the parent, will run against all modules. I don't think that's what you want. You can try:
mvn exec:java -pl module2 -Dexec.mainClass=MyMain
That might work? More info:
Running a specific Maven plugin goal from the command line in a sub-module of a multi-module reactor project
However, I think it's more intuitive to change directory to the sub-module containing the executable before running it.
You should bind the exec-maven-plugin to a maven lifecycle goal, say verify.
Since you want the plugin to be executed only for module2, define the plugin configurations in the parent pom within pluginManagement. Use the same only in module 2.
Then run the following:
mvn verify -Dexec.mainClass=MyMain.
parent pom
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
module 2
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
See this answer for a single-command alternative without mvn install:
https://stackoverflow.com/a/26448447/1235281
By using skip in the parent pom.xml, you can tell Maven to only run exec:java on a specific submodule.
GitHub:
https://github.com/Oduig/mavenfiddle
Related
I am trying to create new maven archetype to generate custom project as per my needs. My project looks like below
My archetype pom looks like following:
<?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>com.tarkshala</groupId>
<artifactId>maven-archetype-tarkshala-service-models</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tarkshala-service-models-archetype</name>
<!-- Used to point local artifacts to the hosted repo , Starts -->
<distributionManagement>
<repository>
<id>nexus</id>
<name>maven-releases</name>
<url>http://maven.tarkshala.com:10081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>maven-snapshots</name>
<url>http://maven.tarkshala.com:10081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<!-- Ends -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>18</source>
<target>18</target>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
<!-- Check we can delete compiler properties-->
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
</project>
and my archetype.xml looks like following
<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
name="maven-archetype-sample" partial="false">
<requiredProperties>
<!-- This is used in pom.xml of the future app. -->
<requiredProperty key="projectName">
<defaultValue>TarkshalaService</defaultValue>
</requiredProperty>
</requiredProperties>
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/**.java</include>
</includes>
</fileSet>
<fileSet filtered="true">
<directory/>
<includes>
<include>*.yml</include>
<include>.gitignore</include>
<include>*.md</include>
<include>*.xml</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
mvn clean install is successful when done on archetype, but mvn generate fails as following
~/W/r/maven-archetype-tarkshala-service-models (master|✚1) [1]$ mvn archetype:generate \
-DarchetypeGroupId=com.tarkshala \
-DarchetypeArtifactId=maven-archetype-tarkshala-service-models \
-DarchetypeVersion=1.0-SNAPSHOT \
-DgroupId=com.tarkshala \
-DartifactId=dhaba-models \
-DprojectName=DhabaModels
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.tarkshala:maven-archetype-tarkshala-service-models:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 31, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -------< com.tarkshala:maven-archetype-tarkshala-service-models >-------
[INFO] Building tarkshala-service-models-archetype 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.2.1:generate (default-cli) > generate-sources # maven-archetype-tarkshala-service-models >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.2.1:generate (default-cli) < generate-sources # maven-archetype-tarkshala-service-models <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.2.1:generate (default-cli) # maven-archetype-tarkshala-service-models ---
[INFO] Generating project in Interactive mode
[WARNING] Archetype not found in any catalog. Falling back to central repository.
[WARNING] Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.892 s
[INFO] Finished at: 2023-01-28T07:38:18+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate (default-cli) on project maven-archetype-tarkshala-service-models: Cannot invoke "org.codehaus.plexus.util.xml.Xpp3Dom.getValue()" because the return value of "org.codehaus.plexus.util.xml.Xpp3Dom.getChild(String)" is null -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Can someone please help to point what exactly am I doing wrong.
I would like to generate a runnable JAR for my Eclipse Java projects. The JAR should contain all my code, with unmodified namespaces, classes, resources etc.
My workspace is organized into a multitude of different projects.
When I right-click a project node in Project Explorer, and select "Run As > Maven install", I get the following:
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< foo.Project1:foo.Project1 >----------------------
[INFO] Building foo.Project1 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for foo.Project2:foo.Project2:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.220 s
[INFO] Finished at: 2020-06-26T12:20:11+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project foo.Project1: Could not resolve dependencies for project foo.Project1:foo.Project1:jar:0.0.1-SNAPSHOT: Could not find artifact foo.Project2:foo.Project2:jar:0.0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
foo.Project1 runs fine under Eclipse. Its pom.xml file is:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo.Project1</groupId>
<artifactId>foo.Project1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>foo.Project2</groupId>
<artifactId>foo.Project2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
(A ZIP of the two projects can be accessed here: https://wetransfer.com/downloads/b9bb4aa840daa6e7b2dd2c793acdb56420200626103047/32c0fd)
I tried the first solution suggested in How can I create an executable JAR with dependencies using Maven? (with 2300+ score) by:
1: adding the following in the build section of the pom.xml:
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>foo.Project1.Application</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
2: right-clicking the project node, then "Run As > Maven build..."
3: defining "Goals" as: clean compile assembly:single, and hitting Run
Same errors.
What am I doing wrong?
If you want to use foo.Project2 as dependency, you need to build it first with clean install.
You always need to build a project before you can use it as dependency in the Maven build.
Eclipse cheats a bit by also allowing you to reference projects from the workspace and therefore allows you to run the program. But for the "real build", you need to build everything in the right order.
I have a JavaFX app that I have successfully built and run with Java SDK 1.8. I am trying to move it to Java 11 with an ultimate goal of using Java 14 and can not create a runnable jar. To try and understand the process I have downloaded the javafx helloFX example and tried to follow the instructions at https://openjfx.io/openjfx-docs/#modular for Maven. When I run the mvn clean javafx:jlink I get the error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.openjfx:hellofx >-------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # hellofx ---
[INFO] Deleting C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\target
[INFO]
[INFO] --- javafx-maven-plugin:0.0.3:jlink (default-cli) # hellofx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\src\main\resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.345 s
[INFO] Finished at: 2020-04-14T14:52:18+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.3:jlink (default-cli) on project hellofx: Error: jlink requires a module descriptor -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The pom.xml is
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openjfx</groupId>
<artifactId>hellofx</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>demo</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>HelloFX</mainClass>
<jlinkImageName>hello></jlinkImageName>
<jlinkZipName>hellozip></jlinkZipName>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- https://mvnrepository.com/artifact/com.zenjava/javafx-maven-plugin -->
Can anyone point me in the correct direction as I am failing to understand the issue.
The provided example is not structured as the tutorial says. The maven version has been updated under the CommandLine folder. If you go to: ..\CommandLine\Modular\Maven\helloFX and enter the commands mvn clean javafx:run, clean javafx:jlink, target\hellofx\bin\launcher it runs as described in the tutorial.
I'm new to Maven, so excuse me if this is so elemental. I have searched about this problem, and everyone seems to solve it removing the tag from the pom.xml file.
I do not have that tag there:
<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>GraphApp</groupId>
<artifactId>GraphApp</artifactId>
<version>1.0.0</version>
<name>MyApp</name>
<description>MyApp</description>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I have converted an existing project with Eclipse, so the problem may come from that.
Also, I have read that the default schema for Maven is storing the code at some default folders, while I'm using src/com/romanrdgz/core/myapp and /test/com/romanrdgz/test/core. That could also be the origin of the problem.
I am seeing this error:
Maven: package org.junit does not exist
What do I need to change?
EDIT: Ok, I have included JUnit4 as dependency, and I have also changed my file folders to be like this:
Still, when I go to console and execute mvn test or mvn compile, I get the following output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GraphApp 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # GraphApp -
--
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\rrrp\workspace\GraphApp\src\
main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # GraphApp ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.515 s
[INFO] Finished at: 2015-04-15T08:15:06+02:00
[INFO] Final Memory: 11M/309M
[INFO] ------------------------------------------------------------------------
I tried erasing bin and target folders, but still the same. Looks like it does not find the classes nor the tests.
Any help?
Add the junit dependency to the pom file in a dependencies section
<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">
.....
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>
Here is a minimal project:
<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>com.test</groupId>
<artifactId>enforcer</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce-env</id>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
<configuration>
<rules>
<requireProperty>
<property>custom</property>
<message>You must set custom property.</message>
</requireProperty>
</rules>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>enforcer-dep</artifactId>
<version>1.0.0</version>
<classifier>${custom}</classifier>
</dependency>
</dependencies>
</project>
When running:
mvn -Dcustom=some-value validate
Validation goes OK.
When running:
mvn enforcer:enforce
or any phase from validate to process-resources
mvn validate
mvn initialize
mvn generate-sources
mvn process-sources
mvn generate-resources
mvn process-resources
I get expected fail with message:
[...]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-env) # enforcer ---
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireProperty failed with message:
You must set custom property.
[...]
But when I run any other (later) phase from compile up to deploy e.g.:
mvn install
I get the error about missing dependency but there is no fail caused by enforcer plugin:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building enforcer 1.0.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.test:enforcer-dep:jar:${custom}:1.0.0 is missing, no dependency information available
Downloading: http://repo.maven.apache.org/maven2/com/test/enforcer-dep/1.0.0/enforcer-dep-1.0.0-${custom}.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.983s
[INFO] Finished at: Fri Nov 22 09:22:24 CET 2013
[INFO] Final Memory: 7M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project enforcer: Could not resolve dependencies for project com.test:enforcer:jar:1.0
.0: Could not transfer artifact com.test:enforcer-dep:jar:${custom}:1.0.0 from/to central (http://repo.maven.apache.org/
maven2): Illegal character in path at index 84: http://repo.maven.apache.org/maven2/com/test/enforcer-dep/1.0.0/enforcer
-dep-1.0.0-${custom}.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
It looks for me like enforcer plugin is not executed at all, or dependencies are checked first before project can be build when running compile and later phases.
But why dependencies are not checked when running up to process-resources?
Obviously you seemed to have changed the settings of the maven installation which went wrong based on the error message:
[WARNING] Some problems were encountered while building the effective settings
[WARNING] expected START_TAG or END_TAG not TEXT (position: TEXT seen ...ever maven must make a connection to a remote s
erver.\n |-->\n <s... #111:5) # C:\programs\Maven\3\bin\..\conf\settings.xml
This means first clean up the conf/settings.xml file. Best is to use the default file which came via the installation. If you need to make modification do this in the users settings.xml $HOME/.m2/settings.xml or on Windows C:/Users/UserName/.m2/settings.xml
Apart from that i don't know what you like to achieve by using something like this:
[WARNING] The POM for com.test:enforcer-dep:jar:${custom}:1.0.0 is missing, no dependency information available
Downloading: http://repo.maven.apache.org/maven2/com/test/enforcer-dep/1.0.0/enforcer-dep-1.0.0-${custom}.jar