[
https://issues.jboss.org/browse/SHRINKWRAP-422?page=com.atlassian.jira.pl...
]
Marco Rietveld updated SHRINKWRAP-422:
--------------------------------------
Description:
It would be great if I could do something like this:
{code:java}
Maven.resolver().loadPomFromFile("pom.xml").importRuntimeDependencies().offline().as(File.class);
{code}
But the (fluent) api doesn't permit the {{.offline()}} method for the class/interface
that's returned from the {{.importRuntimeDependencies()}} methods.
As a workaround, I'm doing this: {code:java}
MavenResolverSystem mrs = Maven.resolver();
PomEquippedResolveStage pers = mrs.loadPomFromFile("pom.xml");
ScopeType[] runtimeScopes = new ScopeType[] { ScopeType.COMPILE, ScopeType.IMPORT,
ScopeType.RUNTIME, ScopeType.SYSTEM };
ResolutionStrategy runtimeStrategy = new AcceptScopesStrategy(runtimeScopes);
FormatStage fs = ((PomEquippedResolveStageBaseImpl)
pers).resolve().offline().using(runtimeStrategy);
File[] dependencyFiles = fs.as(File.class);
{code}
Actually, that doesn't even work.. still trying to figure out how to do it. :/
was:
It would be great if I could do something like this:
{code:java}
Maven.resolver().loadPomFromFile("pom.xml").importRuntimeDependencies().offline().as(File.class);
{code}
But the (fluent) api doesn't permit the {{.offline()}} method for the class/interface
that's returned from the {{.importRuntimeDependencies()}} methods.
As a workaround, I'm doing this: {code:java}
MavenResolverSystem mrs = Maven.resolver();
PomEquippedResolveStage pers = mrs.loadPomFromFile("pom.xml");
ScopeType[] runtimeScopes = new ScopeType[] { ScopeType.COMPILE, ScopeType.IMPORT,
ScopeType.RUNTIME, ScopeType.SYSTEM };
ResolutionStrategy runtimeStrategy = new AcceptScopesStrategy(runtimeScopes);
FormatStage fs = ((PomlessResolveStageBaseImpl)
pers).resolve().offline().using(runtimeStrategy);
File[] dependencyFiles = fs.as(File.class);
{code}
Not as pretty/easy and also, I basically cut and pasted code from the
{{.importRuntimeDependencies()}} method.
Enhance the api to allow .offline() when using the
.import*Dependencies() methods
---------------------------------------------------------------------------------
Key: SHRINKWRAP-422
URL:
https://issues.jboss.org/browse/SHRINKWRAP-422
Project: ShrinkWrap
Issue Type: Feature Request
Components: api, impl-base
Reporter: Marco Rietveld
Priority: Minor
It would be great if I could do something like this:
{code:java}
Maven.resolver().loadPomFromFile("pom.xml").importRuntimeDependencies().offline().as(File.class);
{code}
But the (fluent) api doesn't permit the {{.offline()}} method for the class/interface
that's returned from the {{.importRuntimeDependencies()}} methods.
As a workaround, I'm doing this: {code:java}
MavenResolverSystem mrs = Maven.resolver();
PomEquippedResolveStage pers = mrs.loadPomFromFile("pom.xml");
ScopeType[] runtimeScopes = new ScopeType[] { ScopeType.COMPILE, ScopeType.IMPORT,
ScopeType.RUNTIME, ScopeType.SYSTEM };
ResolutionStrategy runtimeStrategy = new AcceptScopesStrategy(runtimeScopes);
FormatStage fs = ((PomEquippedResolveStageBaseImpl)
pers).resolve().offline().using(runtimeStrategy);
File[] dependencyFiles = fs.as(File.class);
{code}
Actually, that doesn't even work.. still trying to figure out how to do it. :/
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira