Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know groupid and artifactid of any external jars in maven android project

Tags:

android

maven

I am working on maven based android project. I need to add all jars files of libs folder into maven local repositories because many jars are not available into maven central repositories. For this i am going to use following commands.But my question is how to get group-id,artifact-id from any external jar.
Suppose i am having picasso.jar in this case i don't know version too.

 mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>
-DgeneratePom=true

Where:<path-to-file>  the path to the file to load
   <group-id>      the group that the file should be registered under
   <artifact-id>   the artifact name for the file
   <version>       the version of the file
   <packaging>     the packaging of the file e.g. jar

Please help me.

Thanks in Advance

like image 314
DJtiwari Avatar asked Aug 11 '14 07:08

DJtiwari


People also ask

What should be the groupId and artifactId in Maven?

groupId – a unique base name of the company or group that created the project. artifactId – a unique name of the project. version – a version of the project.

How does Maven choose groupId?

A good way to determine the granularity of the groupId is to use the project structure. That is, if the current project is a multimodule project, it should append a new identifier to the parent's groupId - e.g., org. apache. maven, org.

What is artifactId in Maven project?

artifactId is the name of the jar without version. If you created it, then you can choose whatever name you want with lowercase letters and no strange symbols. If it's a third party jar, you have to take the name of the jar as it's distributed.

Which of the following refers to the ID or name of the Maven project?

So ${project.name} refers to the name of the project, ${project. version} refers to the version of the project, ${project. build. finalName} refers to the final name of the file created when the built project is packaged, etc.


1 Answers

The .jars do not have an artifact id. You give them one while mvn installing. For example let's take picasso.jar of your case:

mvn install:install-file
-Dfile=<path-to-your-picasso.jar>
-DgroupId='com.square'
-DartifactId='picasso'
-Dversion=<version-given-by-you-(better using original picasso.jar version)>
-Dpackaging=<packaging>
-DgeneratePom=true

Then while using in your project, you need to add the dependency with this information.

like image 161
faradaj Avatar answered Oct 16 '22 06:10

faradaj