Skip to content

Commit

Permalink
Merge pull request #565 from secondsun/release_plugin_fix
Browse files Browse the repository at this point in the history
Fixing #529

Thanks @secondsun 
This fixes a really annoying I have been having with IntelliJ which was being caused by the _extracted suffix.
  • Loading branch information
william-ferguson-au committed Jan 17, 2015
2 parents a6d99d1 + d9091a5 commit a6f11ba
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,15 @@ private void addClassesToClasspath( UnpackedLibHelper helper, MavenProject proje
throw new MavenExecutionException( "Could not add " + classesJar.getName() + " as dependency", e );
}

// Add the classes to the classpath
final Dependency dependency = createSystemScopeDependency( artifact, classesJar, "extracted" );

// Modify the classpath to use an extracted dex file. This will overwrite
// any exisiting dependencies with the same information.
final Dependency dependency = createSystemScopeDependency( artifact, classesJar, null );
final Dependency providedJar = findProvidedDependencies( dependency, project );
if ( providedJar != null )
{
project.getModel().removeDependency( providedJar );
}
project.getModel().addDependency( dependency );
}

Expand All @@ -285,5 +292,25 @@ private Dependency createSystemScopeDependency( Artifact artifact, File location
dependency.setSystemPath( location.getAbsolutePath() );
return dependency;
}

private Dependency findProvidedDependencies( Dependency dexDependency, MavenProject project )
{
for ( Dependency dependency : project.getDependencies() )
{
if ( dependency.getScope().equals( Artifact.SCOPE_PROVIDED ) )
{
if ( dependency.getArtifactId().equals( dexDependency.getArtifactId() )
&& dependency.getGroupId().equals( dexDependency.getGroupId() )
&& dependency.getType().equals( dexDependency.getType() )
&& dependency.getVersion().equals( dexDependency.getVersion() ) )
{
return dependency;
}
}
}
return null;

}

}

0 comments on commit a6f11ba

Please sign in to comment.