I'm must verify a maven local dependency into a python script. I succeed to do it on linux using this command (from this thread).
mvn dependency:get -Dartifact=g:a:v -o -DrepoUrl=file://~/.m2/repository
My problem is that I'm working with a team using Windows, Linux and Mac, under Windows I'm unable to execute this command, the repo path is the one from mvn configuration maybe the problem is coming from the way I'm calling it as parameter.
mvn dependency:get -Dartifact=g:a:v -o -DrepoUrl=file://C:\Users\user\.m2\repository
Is someone already use this command on Windows and have any hints to solve this problem ?
Thank you .
Finally I reached a solution.
I'm not sure to understand but on windows firstly I must run :
mvn dependency:get
before running :
mvn dependency:get -Dartifact=g:a:v -o
I think the problem about 'dependency plugin' is solved by the first command.
Related
Every time I try a command like
mvnw or mvn clean quarkus:dev I receive this message at terminal:
PS E: \ api-hard-lot>.\mvnw
'powershell' is not recognized as an internal command
or external, an operable program or a batch file.
Error: The main class org.apache.maven.wrapper.MavenWrapperMain could not be found or loaded
I try update my maven, I try change my terminal shell path instead cmd.exe for powershell 7
but nothing works, I am using intelliJ idea 2020.3.2
with java sdk 12
1
thanks guys thats exactly my solution i alter to jdk 8 and
in pom <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> and in code-with-quarkus
I have Backend codes and APIs in a folder I download it from mail. I am using Mac OS.
But when I run ./mvnw in terminal I got the error
-bash: ./mvnw: /bin/sh^M: bad interpreter: No such file or directory
How to overcome this error?
I had the same error as you, installing mvn wrapper in the following way worked for me.
mvn -N io.takari:maven:wrapper
Then cd to the folder where pom.xml file is, and then re-run the ./mvnw command
It looks like your bash gets confused by DOS line endings. This post goes into some detail on how to handle those on MacOS
The error suggests that the mvnw file is not there. Go to your maven project which you need to build and then run mvnw like bellow by pointing to the path of mvnw.
sh /home/user/maven-wrapper-master/mvnw clean install
Or else copy the mvnw file into the maven project directory.
I tried dos2unix filename it works. For using this command we have to install dos2unix
This is the link for install
https://symwisedownload.symantec.com//resources/sites/SYMWISE/content/live/SOLUTIONS/228000/TECH228385/en_US/dos2unix-5.3.3-0.pkg?gda=1539204692_786de4ebe956ae8f24de673f5398dd64
I had the same error, so in this situation ./mvnw doesn`t work, but I tried to write the absolute path to the mvnw file and it works! So try it!
I really like the ability to be able to take a Maven artifact that has some useful code in it that can be run directly from the command line. You could run utilities directly from the command line or scripts without first having to download/install anything.
Right now I'm doing it like this inside a script:
mvn -q dependency:copy -Dartifact=${GROUPID}:${ARTIFACTID}:${VERSION}:pom -DoutputDirectory=${TARGET}
mvn -q dependency:copy -Dartifact=${GROUPID}:${ARTIFACTID}:${VERSION} -DoutputDirectory=${TARGET}
mvn -q dependency:copy-dependencies -f ${TARGET}/${ARTIFACTID}-${VERSION}.pom -DoutputDirectory=dependencies
java -cp ${TARGET}/\*:${TARGET}/dependencies/\* ${MAIN}
I tried doing it with the exec plugin, hoping that I could condense that into a single mvn call, but I wasn't able to get it to work.
Is there a better way to do this? (Like in a single mvn call)
Supposing my maven project is located in /some/location/project and my current location is /another/location/ how can I run maven build without changing to project location cd /some/location/project?
You can use the parameter -f (or --file) and specify the path to your pom file, e.g. mvn -f /path/to/pom.xml
This runs maven "as if" it were in /path/to for the working directory.
I don't think maven supports this. If you're on Unix, and don't want to leave your current directory, you could use a small shell script, a shell function, or just a sub-shell:
user#host ~/project$ (cd ~/some/location; mvn install)
[ ... mvn build ... ]
user#host ~/project$
As a bash function (which you could add to your ~/.bashrc):
function mvn-there() {
DIR="$1"
shift
(cd $DIR; mvn "$#")
}
user#host ~/project$ mvn-there ~/some/location install)
[ ... mvn build ... ]
user#host ~/project$
I realize this doesn't answer the specific question, but may provide you with what you're after. I'm not familiar with the Windows shell, though you should be able to reach a similar solution there as well.
Regards
For me, works this way: mvn -f /path/to/pom.xml [goals]
You can try this:
pushd ../
maven install [...]
popd
If you want to run maven without this command "mvn -f path/to/pom.xml" you can right click on your folder project (in intellij) and click on Rebuild module "name of your artifactId" (corresponding in your pom.xml). It worked for me.
I have a problem, i need to debug a maven project using the mvndebug in fedora Linux, but the terminal does not recognize the mvndebug command.
Fedora's command line is case sensitive, and I believe the command is mvnDebug, with a capital D. Try that.
Does mvn work? If not, you need to sudo yum install maven2 to install it.
The maven debug tool is installed as part of maven's package (yum install maven). Note, however, it's called mvnDebug, with a capital D.