I need to add Oracle JDBC driver in Maven local repository - maven

https://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/
I tried to do
$ mvn install:install-file -Dfile=path/to/your/ojdbc8.jar -DgroupId=com.oracle
-DartifactId=ojdbc8 -Dversion=19.3 -Dpackaging=jar
but errors keep showing
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.068 s
[INFO] Finished at: 2019-11-21T20:48:56+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\Administrateur). Please verify you invoked Maven from the correct directory. -> [Help 1]

Please check that "path/to/your/ojdbc8.jar" doesn't not have spaces or special characters or "quote" it.

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.

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,

Downloading ear file from nexus using maven dependency plugin get goal

I am using the maven dependency plugin get goal to download an artefact from nexus. I can use it to download jar as per below
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=http://nexus.url/nexus/content/groups/public-all/ -Dartifact=groupId:artifactId:version:jar -Dtransitive=false -Ddestination=/my/path
To download a war I can use
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=http://nexus.url/nexus/content/groups/public-all/ -Dartifact=groupId:artifactId:version:war -Dtransitive=false -Ddestination=/my/path
I am however failing to download an ear using the following
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=http://nexus.url/nexus/content/groups/public-all/ -Dartifact=groupId:artifactId:version:ear -Dtransitive=false -Ddestination=/my/path
The output of the above command is as per below
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:get (default-cli) # standalone-pom ---
[INFO] Resolving groupId:artifactId:ear:version
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.797 s
[INFO] Finished at: 2017-10-20T13:31:02+02:00
[INFO] Final Memory: 7M/19M
[INFO] ------------------------------------------------------------------------
I have confirmed that the ear is indeed present in Nexus. The above command runs successfully but the ear is not actually downloaded.
What is wrong with the above command to download the ear? How can I download an ear file from Nexus using the mvn command?
Do note that I have replaced the actual groupId, artifactId and versions in the code above with their respective words.

No pom found while creating new project from archetype

I am trying to execute this :
mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple -DartifactId=simple - DpackageName=org.sonatype.mavenbook -Dversion=1.0-SNAPSHOT"
but it shows this error:
C:\TPMaven>mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple -DartifactId=simple - DpackageName=org.sonatype.mavenbook -Dversion=1.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.090 s
[INFO] Finished at: 2015-04-20T17:28:05+00:00
[INFO] Final Memory: 5M/108M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\TPMaven). Please verify you invoked Maven from the correct directory. -> [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]
What's wrong with my maven statement?
The right code should be:
mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple -DartifactId=simple -DpackageName=org.sonatype.mavenbook -Dversion=1.0-SNAPSHOT
If you use Win, running the code above in cmd.exe is ok.
If you run the code in PowerShell, please use the code below:
mvn archetype:generate "-DgroupId=org.sonatype.mavenbook.simple" "-DartifactId=simple" "-DpackageName=org.sonatype.mavenbook" "-Dversion=1.0-SNAPSHOT"
There are two errors in your code:
mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple -DartifactId=simple - DpackageName=org.sonatype.mavenbook -Dversion=1.0-SNAPSHOT"
- DpackageName
should be
-DpackageName
-Dversion=1.0-SNAPSHOT"
should be
-Dversion=1.0-SNAPSHOT
There is a space in between one of your command line arguments. Running your command:
acanby#PANAMERA /c/projects/mvntest $ mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple -DartifactId=simple - DpackageName=org.sonatype.mavenbook -Dversion=1.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.072 s
[INFO] Finished at: 2015-04-21T15:20:41+10:00
[INFO] Final Memory: 5M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (c:\projects\mvntest). Please verify you invoked Maven from the correct directory
. -> [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/MissingProjectException
Fixing the - DpackageName=... part to -DpackageName=...:
acanby#host /c/projects/mvntest$ mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple -DartifactId=simple -DpackageName=org.sonatype.mavenbook -Dversion=1.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) > generate-sources # standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) < generate-sources # standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) # standalone-pom ---
[INFO] Generating project in Interactive mode

maven error BUILD FAILURE

I am following a maven tutorial. I am trying to execute this command which is my 1st maven command. Tutorial says it will crate a directory named my-app, but it didn't. This is command & its output,
command:
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
output:
C:\Users\Babar>mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=m
y-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom >>
>
[INFO]
[INFO] <<< maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom <<
<
[INFO]
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom --
-
[INFO] Generating project in Batch mode
[INFO] -------------------------------------------------------------------------
---
[INFO] Using following parameters for creating project from Old (1.x) Archetype:
maven-archetype-quickstart:1.0
[INFO] -------------------------------------------------------------------------
---
[INFO] Parameter: groupId, Value: com.mycompany.app
[INFO] Parameter: packageName, Value: com.mycompany.app
[INFO] Parameter: package, Value: com.mycompany.app
[INFO] Parameter: artifactId, Value: my-app
[INFO] Parameter: basedir, Value: C:\Users\Babar
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.971s
[INFO] Finished at: Fri Nov 18 00:07:12 EET 2011
[INFO] Final Memory: 6M/11M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.1:generate (default-cli) on project standalone-pom: Directory my-app already ex
ists - please run from a clean directory -> [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/MojoFailureExc
eption
'cmd' is not recognized as an internal or external command,
operable program or batch file.
error msg says directory already exists but it's not. I execute this command more than oncw
EDIT
command(suggested in answer)
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archet
ypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPS
HOT
OUTPUT
C:\Users\Babar>mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archet
ypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPS
HOT
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom >>
>
[INFO]
[INFO] <<< maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom <<
<
[INFO]
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom --
-
[INFO] Generating project in Interactive mode
[INFO] Archetype repository missing. Using the one from [org.apache.maven.archet
ypes:maven-archetype-quickstart:1.1] found in catalog remote
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.552s
[INFO] Finished at: Fri Nov 18 01:09:15 EET 2011
[INFO] Final Memory: 6M/12M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.1:generate (default-cli) on project standalone-pom: The desired archetype does
not exist (org.apache.maven.archetypes:maven-archetype-quickstart:5-SNAPSHOT) ->
[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/MojoFailureExc
eption
'cmd' is not recognized as an internal or external command,
operable program or batch file.
Close your eclipse
Delete the .m2 folder which shows the server connnection
Re-run your eclipse.
Try this one, it works for maven 3-3-9 for win7 32bit
mvn archetype:generate -DgroupId="com.mycompany.app" -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Try this :
mvn archetype:generate -DgroupId="com.mycompany.app" -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Your sentences have been modified -DgroupId="com.mycompany.app". You need to use double quotes.
I´ve worked on windows 8 and it works. I don´t know if it happens on Linux.
I faced the same issue, and I resolved by run the commond(MVN Clean) from inside the folder where pom.xml located. Please follow below steps:
Open Eclipse
Open your Maven project.
Right Click on pom.xml
Click on properties
5.Copy pom.xml location URL
Open cmd
Write and paste the pom.xml location in the cmd until before /pom.xml as below,
cd C:\Users\X\eclipse-workspace\Your project Name
Hit Enter.
Run mvn clean commond again.
You will note that the original error said
Directory my-app already exists - please run from a clean directory
Did you possibly run that command from a directory where there is already a Maven project (one with a pom.xml file)? If so please start with a clean location.
When I ran the command you used verbatim on an empty directory, it ran without error and created a directory called my-app.
This line is of concern:
[INFO] Using following parameters for creating project from Old (1.x)
Archetype: maven-archetype-quickstart:1.0
Looking at the maven docs page at http://maven.apache.org/archetype/maven-archetype-bundles/maven-archetype-quickstart/, i see that the command you should be using is:
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPSHOT
Which is not exactly what you are running (you are missing the -DarchetypeVersion=5-SNAPSHOT part).

Resources