Domande Su Maven

download Domande Su Maven

of 2

Transcript of Domande Su Maven

  • 7/29/2019 Domande Su Maven

    1/2

    82. What is a system dependency?Answer: Dependency with scope system are always available and arenot looked up inrepository, they are usually used to tell Maven about dependencies which are providedby theJDK or the VM. Thus, system dependencies are especially useful for resolvingdependencies on artifactswhich are now provided by the JDK.83. What is the use of optional dependency?Answer: Optional

    dependencies are used when it is not really possible to split a projectup into sub-modules. The idea is thatsome of the dependencies are only used forcertain features in the project, and will not be needed if that feature isnt used. Itis notonly important to declare optional dependencies in order to save space/memory/etc. it isvital to controlthe list of actual dependencies a person needs in order to use aproject.84. How do you use optional tag?Answer: settingtrue in your dependency declaration.85. What is the difference between optional dependency anddependency exclusion?Answer: improvise86. What does maven-clean-plugin do?Answer: it is responsiblefor removing the target directory of Maven 2 project. The cleanplugin is used when you want to remove thefiles generated at build-time in a projectsdirectory.87. How can you run the clean plugin automatically during the build?Answer: you can put the clean

    plugin inside theexecutiontag in pom.xml file.88. Can you delete files other than that in target directory using clean plugin?Answer:Yes. Using pom.xml file.89. What is the minimal required information for a plugin to be configured?Answer:groupId, artifactId, version.90. Where can you configure your plugins?Answer: in the

    configurationsection in pom.xml91. ******How do you see all the parameters for a given goal?*****Answer: Recent Mavenplugins have generally an help goal to have in the command linethe description of the plugin, with theirparameters and types. To understand the javadocgoal, call:Mvn javadoc:help

    DdetailDgoal=javadoc.92. How can you bind a mojo to a phase/goal?Answer: using the

    @goal,@phaseannotation. It can be overridden byphasetag in pom.xmlfile under plugin configuration.93. How to stop the propagation of plugins to child POMs?Answer: setto false.94. If your plugin has a dependency and you want to use the latest version of that artifact,how canyou avail this?Answer: using the dependency tag inside plugin.95. What can be used to exclude all reports?Answer:

    96. What is the convention for making plugin prefix?Answer:maven-$prefix-plugfor plugins from the apache maven project.$prefix-maven-pluginfor plugins from other sources.97. When Maven determines plugin information?Answer: during build time.98. Why is it illegal to specify amojo using its plugin-prefix when dealing with lifecyclemappings?Answer: this helps Maven avoid the case where the jar lifecycle behaves differently ontwo users machines,simply due to their local Maven configuration.99.How do Maven resolves plugins version?

    Answer: Projects POM, pluginregistry, latest version metadata, release versionmetadata.100. What is the packaging type of archtype?Answer: JAR.101. What is the command to install 3

  • 7/29/2019 Domande Su Maven

    2/2

    rdparty JARs in local repository?Answer:mvn install:install-file -Dfile= -DgroupId= \ -DartifactId=-Dversion= -Dpackaging=102. Which plugin you would use in Maven to call your class?Answer: exec:java