Skip to content

Commit

Permalink
[MPLUGIN-437] Fixes to the plugin descriptor generation (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 28, 2022
1 parent 339fc29 commit ebdb063
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
Expand Up @@ -540,21 +540,30 @@ protected void extendJavaProjectBuilderWithSourcesJar( JavaProjectBuilder builde
return;
}

// extract sources to target/maven-plugin-plugin-sources/${groupId}/${artifact}/sources
File extractDirectory = new File( request.getProject().getBuild().getDirectory(),
if ( sourcesArtifact.getFile().isFile() )
{
// extract sources to target/maven-plugin-plugin-sources/${groupId}/${artifact}/sources
File extractDirectory = new File( request.getProject().getBuild().getDirectory(),
"maven-plugin-plugin-sources/" + sourcesArtifact.getGroupId() + "/"
+ sourcesArtifact.getArtifactId() + "/" + sourcesArtifact.getVersion()
+ "/" + sourcesArtifact.getClassifier() );
extractDirectory.mkdirs();
extractDirectory.mkdirs();

UnArchiver unArchiver = archiverManager.getUnArchiver( "jar" );
unArchiver.setSourceFile( sourcesArtifact.getFile() );
unArchiver.setDestDirectory( extractDirectory );
unArchiver.extract();
UnArchiver unArchiver = archiverManager.getUnArchiver( "jar" );
unArchiver.setSourceFile( sourcesArtifact.getFile() );
unArchiver.setDestDirectory( extractDirectory );
unArchiver.extract();

extendJavaProjectBuilder( builder,
Arrays.asList( extractDirectory ),
request.getDependencies() );
extendJavaProjectBuilder( builder,
Arrays.asList( extractDirectory ),
request.getDependencies() );
}
else if ( sourcesArtifact.getFile().isDirectory() )
{
extendJavaProjectBuilder( builder,
Arrays.asList( sourcesArtifact.getFile() ),
request.getDependencies() );
}
}
catch ( ArchiverException | NoSuchArchiverException e )
{
Expand Down
Expand Up @@ -34,7 +34,6 @@
import com.thoughtworks.qdox.JavaProjectBuilder;
import com.thoughtworks.qdox.builder.TypeAssembler;
import com.thoughtworks.qdox.library.ClassNameLibrary;
import com.thoughtworks.qdox.library.SourceLibrary;
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaField;
import com.thoughtworks.qdox.model.JavaModule;
Expand Down Expand Up @@ -81,13 +80,6 @@ public JavaClassConverterContext( JavaClass mojoClass, JavaClass declaringClass,
Map<String, MojoAnnotatedClass> mojoAnnotatedClasses,
JavadocLinkGenerator linkGenerator, int lineNumber )
{
if ( !( mojoClass.getJavaClassLibrary() instanceof SourceLibrary )
|| !( declaringClass.getJavaClassLibrary() instanceof SourceLibrary ) )
{
throw new IllegalStateException( "The given javaClasses must be loaded by SourceLibrary to have access to"
+ "e.g. the imports statements in it" );
}

this.mojoClass = mojoClass;
this.declaringClass = declaringClass;
this.javaProjectBuilder = javaProjectBuilder;
Expand Down

0 comments on commit ebdb063

Please sign in to comment.