cstamas commented on code in PR #31:
URL: 
https://github.com/apache/maven-install-plugin/pull/31#discussion_r912534598


##########
src/main/java/org/apache/maven/plugins/install/AbstractInstallMojo.java:
##########
@@ -49,28 +56,98 @@
      * Gets the path of the specified artifact within the local repository. 
Note that the returned path need not exist
      * (yet).
      *
-     * @param buildingRequest {@link ProjectBuildingRequest}.
      * @param artifact The artifact whose local repo path should be 
determined, must not be <code>null</code>.
      * @return The absolute path to the artifact when installed, never 
<code>null</code>.
      */
-    protected File getLocalRepoFile( ProjectBuildingRequest buildingRequest, 
Artifact artifact )
+    protected File getLocalRepoFile( Artifact artifact )
     {
-        String path = repositoryManager.getPathForLocalArtifact( 
buildingRequest, artifact );
-        return new File( repositoryManager.getLocalRepositoryBasedir( 
buildingRequest ), path );
+        String path = 
session.getRepositorySession().getLocalRepositoryManager()
+                .getPathForLocalArtifact( RepositoryUtils.toArtifact( artifact 
) );
+        return new File( 
session.getRepositorySession().getLocalRepository().getBasedir(), path );
     }
 
     /**
      * Gets the path of the specified artifact metadata within the local 
repository. Note that the returned path need
      * not exist (yet).
      *
-     * @param buildingRequest {@link ProjectBuildingRequest}.
      * @param metadata The artifact metadata whose local repo path should be 
determined, must not be <code>null</code>.
      * @return The absolute path to the artifact metadata when installed, 
never <code>null</code>.
      */
-    protected File getLocalRepoFile( ProjectBuildingRequest buildingRequest, 
ProjectArtifactMetadata metadata )
+    protected File getLocalRepoFile( ProjectArtifactMetadata metadata )
     {
-        String path = repositoryManager.getPathForLocalMetadata( 
buildingRequest, metadata );
-        return new File( repositoryManager.getLocalRepositoryBasedir( 
buildingRequest ), path );
+        DefaultArtifact pomArtifact = new DefaultArtifact(
+                metadata.getGroupId(),
+                metadata.getArtifactId(),
+                "",
+                "pom",
+                metadata.getBaseVersion() );
+
+        String path = 
session.getRepositorySession().getLocalRepositoryManager().getPathForLocalArtifact(
+                pomArtifact );
+        return new File( 
session.getRepositorySession().getLocalRepository().getBasedir(), path );
     }
 
+    protected void installProject( MavenProject project )
+            throws MojoFailureException, MojoExecutionException
+    {
+        try
+        {
+            InstallRequest request = new InstallRequest();
+            Artifact artifact = project.getArtifact();
+            String packaging = project.getPackaging();
+            File pomFile = project.getFile();
+            boolean isPomArtifact = "pom".equals( packaging );
+
+            if ( pomFile != null )
+            {
+                request.addArtifact( RepositoryUtils.toArtifact( new 
ProjectArtifact( project ) ) );
+            }
+
+            if ( !isPomArtifact )
+            {
+                File file = artifact.getFile();
+
+                // Here, we have a temporary solution to MINSTALL-3 
(isDirectory() is true if it went through compile

Review Comment:
   I lifted the relevant MAT code here, so this PR does not change "logic", it 
merely moves it into this plugin (that was before in MAT). So, just like in 
https://github.com/apache/maven-install-plugin/pull/15 "minimal change" is in 
place, that will subsequent PRs refine.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to