How to add unmanned jars directory to specif profile in Maven with out install - maven

I want to add my jars library which is c:\tmp\jars\ (more than 100 jars files) to specific profile in Maven with out installing.
Installing each jar in maven and adding each dependency is not i'm looking.
I'm using Intellij and Maven
I can add the jar directory by project module settings add Jars but its applicable to all profiles, i want add this jars to specific profile.
for example y project has 2 profiles hdp,azure
for hdp profile the external jars not required but azure profile the external jar required.
Agian I don't want to install in maven add each dependency is not my option.

If the jars are not listed as dependencies in your POM, Maven cannot see them.
Even if IntelliJ sees them, you get a strange hybrid project that Maven cannot build any more.

Related

Update Maven Dependencies Jars

I am new to Maven and have a quick question. I am using the JBoss IDE and have my Maven project set up. I have several jar files in my Maven Dependencies build path that need to be updated to a newer version. I have tried adding the external jars manually, but they do not go within the Maven Dependencies library and the outdated jar remains within that library.
What is the best way to update the jars with the Maven Dependencies library?

Best way to attach additional jars to maven project [java]

I have a maven based project, which after execution I want to install all the generated jars to the maven repository.
I cannot add additional jar details in the pom.xml because the additional jars are not static.
The only option for me to add them through a custom mojo.
I have created my own mojo and installed the main project jars.
What would be the best way to attach the additional generated jars.
I tried the method, addAttachedArtifact(..) in MavenProject and it installed the additional jar files but not generating a default pom.xml for the additional jar files.
I m not sure what would be the best way to indicate to generate default pom.xml for additional jars while installing into the maven repository.
Thanks in advance!

Maven in Netbeans8: how to add jars to local repository

I use Maven bundled in NetBeans8. I have a lot of Maven projects, but also a lot of jar files provided by third parties which are not available from any online Maven repository.
I have to use these jars in one of my Maven projects. I read in this SO answer that I should copy the jars in my local repository! How can I do that in NetBeans with my bundled Maven?
You can either do it from the command line as explained in your link. Maven is in netbeans installation folder/java/maven/bin/mvn.bat on Windows. Not sure on other platform.
Alternatively, you can expand your project's "Dependencies" folder, right click on the jar and select "Manually install artifact".

What is the purpose of providing a downloaded pom.xml on mvnrepository.com

On mvnrepositry, when you search for a certain module, there's a link to download the binary. For some versions it has a pom.xml file available for download instead of the jar. What are you supposed to do with that pom.xml? It seems like if I specify a version that does not have a downloadable jar, but instead downloadable pom.xml, my maven build will fail. Is what I'm seeing correct?
Modules that only have pom files are maven modules with pom packaging. They are used to aggregate multiple modules into one unit. You can use such a module as a dependency for your maven project. Maven will download the pom file, analyze the dependencies included in that pom file and download those & add it to your automatically.
Even modules that have jars (jar packaging) have a pom file associated with them. This pom file defines the other dependencies that are required for using it. Maven will automatically process and fetch those dependencies (transitive dependencies).
This makes specifying and managing dependency for any project. You will specify the top level modules that your projects directly depends on and other things required will automatically figured out and downloaded. It also makes it easier when you have upgrade to a new version - all the transitive dependencies will get upgraded automatically.
One of the reason that cause this is because of licensing issue.
License for such JARs prohibit public redistribution in such approach. So someone provide only the POM so that you can get the JAR yourself and install it to your local maven repo/ internal repo, together with the POM provided.

Maven beginner question, get m2eclipse to download jar and add to build path?

From what I have read, after adding the relevant maven repositories, maven should automatically download the necessary jars to satisfy dependencies in the pom.xml file.
However, no jars ever get downloaded for me after I add dependencies in eclipse. Am I missing some glaringly obvious step?
I'd recommend to start from creating your project with m2eclipse. See more details in this article.
Basically, you need to make sure the following:
your Eclipse project has a valid pom.xml and all dependencies are available (you should see errors on Maven console, in the Problems or Markers view or when opening pom.xml in m2eclipse's POM editor)
Maven support is enabled for this project (you can use Maven / Enable Dependency Management from popup menu on that project)
project configuration is in sync with pom.xml (you can use Maven / Update Project Configuration from the project popup menu)
you can also use Maven / Update Dependencies to refresh your dependencies (e.g. when you got them in your Local Maven repo from the command line)
Dependencies jars aren't in your project but in your local maven repository.
These jars will be automatically used when you compile you project with maven (or m2eclipse).
If you don't have the needed jar yet, maven will download it for you.

Resources