org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2 error - maven

I have the following Maven project structure:
xyz
|
-props
| |
| - root.properties
|
-module_a
| |
| -pom.xml
|
-pom.xml
My root artifact defines a child module (module_a) and this is referencing the parent artifact.
In the root pom.xml I am reading a property file from the common props folder using the
org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2 plugin.
When I issue the
mvn clean package
command I get the following putput:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] my_artifact
[INFO] module_a
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building my_artifact 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # my_artifact ---
[INFO]
[INFO] --- properties-maven-plugin:1.0-alpha-2:read-project-properties (default) # my_artifact ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building module_a 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # module_a ---
[INFO]
[INFO] --- properties-maven-plugin:1.0-alpha-2:read-project-properties (default) # module_a ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] my_artifact ....................................... SUCCESS [0.234s]
[INFO] module_a .......................................... FAILURE [0.000s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.344s
[INFO] Finished at: Thu Aug 09 15:37:46 CEST 2012
[INFO] Final Memory: 2M/5M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties (default) on project module_a: Properties file not found: G:\java\xyz\module_a\props\root.properties -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :module_a
In the child module Maven tries to read the property file from an inexistetnt subfolder. Can anybody help me solve this?
Thank you

When maven evaluates the pom files and creates the effective poms ( aggregated with inheritance) some properties are excluded from being inherited. These are the ones starting with project.* and therefore also the project.basedir. Thats why you cannot define the property from where the property file is being loaded in the parent.
The reason for this behaviour is isolation. Every module should be isolated from everything but the maven repository. Even using the settings.xml profiles violates this invariant and you loose the portability of builds.
This invariant is not necessary in many cases so if you have many modules and you want to use one property file, what you can do is:
define a property e.g. "filters.dir" in your root pom to ${project.basedir}/src/main/filters
configure the plugin to load a property file from ${filters.dir}/my.properties
in any submodule you can now override filters.dir to ../src/main/filters
if you have many submodules you can define a wrong path "../src/main/filters" for filters.dir in the root and then you don't need to define the property in any submodule. To prevent the build from failing you need to set the plugin to ignore failures.
An alternative would be to write a maven extension by extending AbstractMavenLifecycleParticipant and load the property file there using the maven api to determine the root directory of your project.

I have face a similar issue.
I have a parent project pom.xml which has a build.properties file
the parent project has several modules.
When I created a new module, and wanted to build the whole parent project, I got:
[ERROR] Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties (default) on project attachment-services: Properties file not found: /home/raz/git/parent/attachment-services/build.properties -> [Help 1]
To fix this, I have added in the new module's pom.xml the following
<properties>
<build.properties.location>..</build.properties.location>
</properties>
and of course, this build.properties.location was already defined in the parent pom, like:
<properties>
<build.properties.location>${project.basedir</build.properties.location
</properties>

Related

Building Gluon Apps in Multi-Module Project

TL;DR: How does one build a Gluon app that's part of a larger multi-module project?
I have a multi-module Mave project (that is, my top-level POM has "<packaging>pom</packaging>"). The project contains a bunch of libraries and related sub-projects, one of which is a Gluon app that will be what my actual users install. (The rest of the project is all the cloud-hosted plumbing that the client app connects to.)
When I try to build the Gluon app, per the Gluon documentation, I am getting the following error:
mvn gluonfx:build
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] app [pom]
[INFO] app-common [jar]
[INFO] app-server [jar]
[INFO] app-client [jar]
[INFO] app-test [jar]
[INFO] app-utilities [jar]
[INFO] app-integration-lambda [jar]
[INFO] app-integration-jakarta [war]
[INFO] app-gluon [jar]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for app 0.9:
[INFO]
[INFO] app ............................................ SKIPPED
[INFO] app-common ..................................... SKIPPED
[INFO] app-server ..................................... SKIPPED
[INFO] app-client ..................................... SKIPPED
[INFO] app-test ....................................... SKIPPED
[INFO] app-utilities .................................. SKIPPED
[INFO] app-integration-lambda ......................... SKIPPED
[INFO] app-integration-jakarta ........................ SKIPPED
[INFO] app-gluon ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.298 s
[INFO] Finished at: 2022-02-22T21:03:18+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'gluonfx' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Administrator\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [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/NoPluginFoundForPrefixException
If I run Maven so that it only builds the Gluon application instead, like this:
mvn gluonfx:build --projects "app-gluon" --also-make
I get basically the same error. If I cd to app-gluon first, I get a different error (and I didn't expect this to work anyhow):
cd app-gluon
mvn gluonfx:build
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.whatever:app-gluon >--------------------
[INFO] Building app-gluon 0.9
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.whatever:app-common:jar:0.9 is missing, no dependency information available
[WARNING] The POM for com.whatever:app-client:jar:0.9 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.380 s
[INFO] Finished at: 2022-02-22T21:09:12+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project app-gluon: Could not resolve dependencies for project com.whatever:app-gluon:jar:0.9: The following artifacts could not be
resolved: com.whatever:app-common:jar:0.9, com.whatever:app-client:jar:0.9: com.whatever:app-common:jar:0.9 was not found in https://nexus.gluonhq.com/nexus/
content/repositories/releases during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of Gluon has elapsed or updates are forced -> [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
So my question is: how does one build a Gluon app that's part of a larger multi-module project?
If you have a multi module project, and your app module depends on other modules, you need to publish those modules to a repository, so the app module finds them, like any other third party dependency.
Typically, for local development, you can simply use mvn install from the root folder to deploy your project locally. Of course, for distribution, you should consider publishing them to a reachable repository.
Make sure all your modules are deployed to your ~/.m2 repository.
Then you can run from the root:
mvn gluonfx:build -f app-gluon
or enter in the app-gluon folder:
cd app-gluon
mvn gluonfx:build
And remember that every time you make any change to the other modules, you will need to publish them again before building the native image.
Also, since you can run your app on the JVM, before building the native image (which takes a couple of minutes), you can simply run and test:
mvn gluonfx:run
and if that works fine, do the native image build.

Codename One online building error by terminal

I'm trying to use my CN1 account to compile online my project whit Ubuntu 16.04 LTS terminal command:
$ mvn cn1:build -Dcodename1.platform=android -Dcodename1.buildTarget=android-device
but I got this long error:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for bo.conectica.carry:carry-common:jar:1.0-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.systemPath' for com.codenameone:codenameone-buildclient:jar refers to a non-existing file /home/synapsido/.codenameone/CodeNameOneBuildClient.jar # bo.conectica.carry:carry:1.0-SNAPSHOT, /home/synapsido/Documentos/carry/pom.xml, line 293, column 21
[WARNING]
[WARNING] Some problems were encountered while building the effective model for bo.conectica.carry:carry-android:jar:1.0-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.systemPath' for com.codenameone:codenameone-buildclient:jar refers to a non-existing file /home/synapsido/.codenameone/CodeNameOneBuildClient.jar # bo.conectica.carry:carry:1.0-SNAPSHOT, /home/synapsido/Documentos/carry/pom.xml, line 293, column 21
[WARNING]
[WARNING] Some problems were encountered while building the effective model for bo.conectica.carry:carry:pom:1.0-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.systemPath' for com.codenameone:codenameone-buildclient:jar refers to a non-existing file /home/synapsido/.codenameone/CodeNameOneBuildClient.jar # line 293, 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] Reactor Build Order:
[INFO]
[INFO] carry [pom]
[INFO] carry-common [jar]
[INFO] carry-android [jar]
[INFO]
[INFO] ----------------------< bo.conectica.carry:carry >----------------------
[INFO] Building carry 1.0-SNAPSHOT [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> codenameone-maven-plugin:7.0.36:build (default-cli) > package # carry >>>
[INFO]
[INFO] <<< codenameone-maven-plugin:7.0.36:build (default-cli) < package # carry <<<
[INFO]
[INFO]
[INFO] --- codenameone-maven-plugin:7.0.36:build (default-cli) # carry ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for carry 1.0-SNAPSHOT:
[INFO]
[INFO] carry .............................................. FAILURE [ 10.155 s]
[INFO] carry-common ....................................... SKIPPED
[INFO] carry-android ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.516 s
[INFO] Finished at: 2022-01-09T21:32:07-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.codenameone:codenameone-maven-plugin:7.0.36:build (default-cli) on project carry: Execution default-cli of goal com.codenameone:codenameone-maven-plugin:7.0.36:build failed: Plugin com.codenameone:codenameone-maven-plugin:7.0.36 or one of its dependencies could not be resolved: Could not find artifact com.codenameone:codenameone-buildclient:jar:7.0.36 at specified path /home/synapsido/.codenameone/CodeNameOneBuildClient.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/PluginResolutionException
maybe my mvn plugin version is deprecated? How to Update?
That particular target doesn't seem to trigger the download of that dependency. If you run mvn verify first, or the "Run In Simulator" option in your IDE, it will cause these dependencies to be downloaded.
e.g.
mvn verify
then
mvn cn1:build -Dcodename1.platform=android -Dcodename1.buildTarget=android-device
will work.
It seems that this is an older version of the maven plugin (7.0.36) where the current is 7.0.55. Make sure to update the version and dependencies. You can use https://start.codenameone.com/ to generate a new reference.
The new version no longer depends on the file in that location.

CodeHaus Maven JAXB2 plugin error MojoExecutionException: NoSchemasException

I am trying to build my project ,in that i got error called [ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.4:xjc (One) on project tg-tg-tems-ota-common-service: : MojoExecutionException: NoSchemasException -> [Help 1]
we are using java8 ,apache maven 3.6.3 ,jaxb2 plugin 2.4
Please find below error
INFO] Building TravelGrid-Tems-Ota-Service 3.0.0-SNAPSHOT [2/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # tg-tg-tems-ota-common-service ---
[INFO]
[INFO] --- jaxb2-maven-plugin:2.4:xjc (One) # tg-tg-tems-ota-common-service ---
[INFO] Created EpisodePath [D:\Sushma_Project\TG_UPGRADATION\Project\branches\3.0.0-SNAPSHOT\tems\tg-tems-servicelayer\tg-tems-ota-common-service\target\generated-sources\jaxb\emt\hotelSearchRequest\META-INF\JAXB]: true
[INFO] Ignored given or default xjbSources [D:\Sushma_Project\TG_UPGRADATION\Project\branches\3.0.0-SNAPSHOT\tems\tg-tems-servicelayer\tg-tems-ota-common-service\src\main\xjb], since it is not an existent file or directory.
[INFO] Ignored given or default sources [D:\Sushma_Project\TG_UPGRADATION\Project\branches\3.0.0-SNAPSHOT\tems\tg-tems-servicelayer\tg-tems-ota-common-service\src\main\xsd], since it is not an existent file or directory.
[WARNING] No XSD files found. Please check your plugin configuration.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for tg-servicelayer 3.0.0-SNAPSHOT:
[INFO]
[INFO] tg-servicelayer .................................... SUCCESS [ 0.697 s]
[INFO] TravelGrid-Tems-Ota-Service ........................ FAILURE [ 0.909 s]
[INFO] TravelGrid-Subsystems .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.941 s
[INFO] Finished at: 2020-06-30T15:50:30+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.4:xjc (One) on project tg-tg-tems-ota-common-service: : MojoExecutionException: NoSchemasException -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :tg-tg-tems-ota-common-service
D:\Sushma_Project\TG_UPGRADATION\Project\branches\3.0.0-SNAPSHOT\tems\tg-tems-servicelayer>
I am new to jaxb plugin ,can anyone help me
Please user "mvn clean install" it will clean the target folder and regenerate everything from scratch.

JBoss Fuse 6.3, Maven and settings.xml

I'm trying to follow Red Hat JBoss Fuse-6.3 Developer Guide. I added everything to the Windows: Documents and Settings\User\.m2\settings.xml (which didnt exist) as per the document.The build command I'm using is
C:\Apps\apache-maven-3.5.0\bin\mvn archetype:generate -DarchetypeGroupId=io.fabric8.archetypes -DarchetypeArtifactId=karaf-soap-archetype -DarchetypeVersion=1.2.0.redhat-630187 -DgroupId=org.fusesource.example -DartifactId=cxf-basic -Dversion=1.0-SNAPSHOT -Dfabric8-profile=cxf-basic-profile
I'm now getting this error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources # standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) < generate-sources # standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) # standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [io.fabric8.archetypes:karaf-soap-archetype:1.2.0.redhat-133] found in catalog remote
[WARNING] The POM for io.fabric8.archetypes:karaf-soap-archetype:jar:1.2.0.redhat-630187 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.056 s
[INFO] Finished at: 2018-01-17T10:31:19-07:00
[INFO] Final Memory: 12M/54M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: The desired archetype does not exist (io.fabric8.archetypes:karaf-soap-archetype:1.2.0.redhat-630187) -> [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
C:\P\Projects\JBoss_Dev_Studio-10.1.0.GA_SideProjects\get-started>
I do see that archetype exists.
Googling around for archetype does not exist (io.fabric8.archetypes:karaf-soap-archetype:1.2.0.redhat-630187 and yes! It's one of those 0 results found!
The key turned out to be this
[INFO] Archetype repository not defined. Using the one from [io.fabric8.archetypes:karaf-soap-archetype:1.2.0.redhat-133] found in catalog remote
[WARNING] The POM for io.fabric8.archetypes:karaf-soap-archetype:jar:1.2.0.redhat-630187 is missing, no dependency information available
And me being a bit of a newb with Maven - I didnt understand it first. I then googled a bit more for settings.xml - I then found mention of a settings.xml also contained in C:\Apps\apache-maven-3.5.0\conf
I added the Red Hat repositories to that file instead (as it was completely empty) and everything now builds properly. Hopefully this might help someone else figure out a similar problem faster than I did whether it's with regards to jboss fuse or maven not being correctly setup,

java project not getting analysed in sonar 3.3.5

When I give mvn sonar:sonar for sample java project in sonar I get this error.The sample project is from link
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple Java Maven Project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:2.0:sonar (default-cli) # example-java-maven ---
[INFO] Sonar version: 3.5.1
[INFO] [12:29:59.781] Load batch settings
[INFO] [12:30:00.000] User cache: C:\Documents and Settings\xxx\.sonar\cache
[INFO] [12:30:00.156] Install plugins
INFO] [12:30:03.250] ------------- Executing Project Scan
[INFO] [12:30:04.500] Install JDBC driver
INFO] [12:30:04.515] Apply project exclusions
[WARN] [12:30:04.531] H2 database should be used for evaluation purpose only
[INFO] [12:30:04.531] Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
[INFO] [12:30:04.890] Initializing Hibernate
[INFO] [12:30:09.500] ------------- Inspecting Simple Java Maven Project
[INFO] [12:30:09.515] Load module settings
[INFO] [12:30:09.937] Excluded tests:
[INFO] [12:30:09.937] **/package-info.java
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.125s
[INFO] Finished at: Thu Jun 13 12:30:11 IST 2013
[INFO] Final Memory: 9M/28M
[INFO] ------------------------------------------------------------------------
ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (d
efault-cli) on project example-java-maven: Can not execute Sonar: You must insta
ll a plugin that supports the language 'java' -> [Help 1]
ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
Should I manually put any plugin to analyze java project?
It looks like you have removed the Java plugins from your Sonar home directory. You can upload the latest version at http://docs.codehaus.org/display/SONAR/Java+Ecosystem, copy the plugins into SONAR_HOME/extensions/plugins and restart your Sonar server.

Resources