Problems with Maven

Asked

Viewed 21 times

0

Hello I read how Maven works, but there is one thing I don’t understand I will depend on Maven after creating my executable program ? i’m a beginner in java, I would also like to know how to use the musicg library with Maven because my goal is an executable independent of anything installed but this package uses Maven, there would be no way to add it normally in eclipse ?

I’m trying to execute: https://lstsal.wordpress.com/2015/02/25/an-easy-way-to-compare-two-audios/

1 answer

0

I will depend on Maven after creating my executable program?

No, it will no longer depend on Maven after generating its executable.

Maven is a tool aimed at organizing your project, you will describe its dependencies, modules, external components, plugins, compilation order, treatments on the generated artifacts, following a series of predefined actions (clean, install, package, deploy...)

The process of generating an executable, or an artifact that will be used to deploy, takes place in one of the build phases (package). There are settings to be made at this stage, run by packaging plugins for example.


In short, to generate the executable of a project using Maven, you must perform the package Maven. After the generated artifact, there is no need to use Maven anymore, usually the compilation result is placed in the folder target (which can also be customized).


In your case, whether the result of your compilation would be a jar, just access your artifact in the directory target of the project, and implement the jar normally using java -jar meujar.jar.

Another example would be a compilation of a web application, the war or ear will be generated in the directory target, the next step would be to make this artifact available on a web server to deploy.

Noted that the interaction with Maven ends after the generation of artifacts?

  • Thank you very much, friend I am using the musicg library that was made in Maven and was created to be imported into the eclipse IDE I can simply import a Maven Jar without the Maven installed or there is a need as I can’t compile my program with Package Maven have any idea of the motive ?

  • see my project trying to import a Maven Jar, the question was asked to me to better understand how Maven works already the site explains more how to use itself. See my other problem: https://answall.com/questions/522294/erro-ao-import-pacote-e-executar-codigo-na-ide-eclipse-java

  • If you are using Maven, you should use Maven. If you add the dependency directly to the IDE, Maven will not be aware of it

  • If your jar is not in an artifact repository, you will need to add it there. Here has an example of how to install a third-party artifact (a jar without pom.xml for example) in your local repository, and then add it to your project’s pom.xml.

  • You could say that this comment I made is the answer to the question you added in the comment, you can’t use Maven + dependencies in the IDE, you need to include via pom.xml only, I’ll copy the explanation to you later.

  • thanks friend I am waiting for the explanation there I am trying to compile and I used everything I know java but it is not enough I will see more about Maven, as you said above depending only will need to declare and configure the pom.xml

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.