[Solved] Understanding Java Artifacts and Maven


  1. Is there a file associated with this artifact?

Yes, what you have posted is known as a coordinate. It references a jar named selenium-java that is in the group org.seleniumhq.selenium.

Groups, identified by the groupId component of the coordinate, are a way of namespacing artifacts within maven to prevent naming collisions.

This coordinate says that the project has a dependency on version 2.53.0 of a maven artifact named selenium-java in the group org.seleniumhq.selenium.

  1. Is this enough information to pull down the file down when building your Maven Project?

Yes, the coordinate is how the artifact is located within the maven repository and is enough information to locate and download the artifact when building a maven project.

  1. Where is it getting the file from? Is it getting it from selenium, or does Maven house these artifacts, and it is getting from Maven?
    Where exactly is it downloading the artifact from?

Where the file is retrieved from is based on your maven configuration. By default maven will first check the local maven repository on your machine to see if the artifact has already been downloaded. If not, it will then check Maven Central.

You can also host your own maven repositories using tools such as Nexus or Artifactory that can mirror repositories on the internet such as Maven Central as well as store artifacts you create yourself that you do not with to share with others.

  1. What’s in the artifact file? Class definitions? Multiple classes can be defined in there, right?

An artifact can be any type of file. In the case of the selenium coordinate above the artifact is a jar file. There will also be a pom file associated with that coordinate that explains all of the dependencies of the selenium-java jar.

  1. Maven seems to be making a jar file. Is it compounding all the classes into that file?

You can build normal jars or fat jars with maven. By default maven will build a normal jar. If you wish to package all of a jars dependencies within it (i.e. fat jar) you need to use a special maven plugin.

  1. Also, how is artifact file different from JAR file and can you make your own artifact file?

Artifact is a generic term used to describe anything you can store within a maven repository. Maven repositories can store many different types of files. In the case of this coordinate the artifact is a jar file.

1

solved Understanding Java Artifacts and Maven