[JBoss JIRA] (SHRINKRES-196) FormatStage should work in a JDK8 friendly way
by John Ament (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-196?page=com.atlassian.jira.plu... ]
John Ament updated SHRINKRES-196:
---------------------------------
Status: Pull Request Sent (was: Open)
Git Pull Request: https://github.com/shrinkwrap/resolver/pull/71
I have pulled the request. Let me know your thoughts. I only included asList (and not asFileList, etc) since you can just do asList(File.class) to get the same result.
> FormatStage should work in a JDK8 friendly way
> ----------------------------------------------
>
> Key: SHRINKRES-196
> URL: https://issues.jboss.org/browse/SHRINKRES-196
> Project: ShrinkWrap Resolvers
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: api, impl-maven
> Affects Versions: 2.2.0-alpha-1, 2.2.0-alpha-2
> Reporter: John Ament
>
> Currently, FormatStage only returns arrays. In JDK8 if I want to stream the results to merge JARs, I have to do this:
> JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "se-examples.jar").addPackage(UndertowComponent.class.getPackage())
> .addPackage(ExampleConfigSource.class.getPackage()).addPackage(GreeterServlet.class.getPackage())
> .addAsManifestResource(new StringAsset(beansXml),"beans.xml");
> Arrays.stream(Maven.resolver().loadPomFromFile("pom.xml")
> .resolve("org.apache.deltaspike.core:deltaspike-core-api","org.apache.deltaspike.core:deltaspike-core-impl")
> .withTransitivity().as(JavaArchive.class)).forEach(jar::merge);
> The Arrays.stream here is ugly as sin, requires me to wrap the result. It would be better if there was an asList(Class<?>) method that did the appropriate type conversion and returned as a list of whatevers.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 7 months
[JBoss JIRA] (SHRINKRES-196) FormatStage should work in a JDK8 friendly way
by John Ament (JIRA)
John Ament created SHRINKRES-196:
------------------------------------
Summary: FormatStage should work in a JDK8 friendly way
Key: SHRINKRES-196
URL: https://issues.jboss.org/browse/SHRINKRES-196
Project: ShrinkWrap Resolvers
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: api, impl-maven
Affects Versions: 2.2.0-alpha-2, 2.2.0-alpha-1
Reporter: John Ament
Currently, FormatStage only returns arrays. In JDK8 if I want to stream the results to merge JARs, I have to do this:
JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "se-examples.jar").addPackage(UndertowComponent.class.getPackage())
.addPackage(ExampleConfigSource.class.getPackage()).addPackage(GreeterServlet.class.getPackage())
.addAsManifestResource(new StringAsset(beansXml),"beans.xml");
Arrays.stream(Maven.resolver().loadPomFromFile("pom.xml")
.resolve("org.apache.deltaspike.core:deltaspike-core-api","org.apache.deltaspike.core:deltaspike-core-impl")
.withTransitivity().as(JavaArchive.class)).forEach(jar::merge);
The Arrays.stream here is ugly as sin, requires me to wrap the result. It would be better if there was an asList(Class<?>) method that did the appropriate type conversion and returned as a list of whatevers.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 7 months
[JBoss JIRA] (SHRINKRES-190) implements equals and hashCode methods in MavenResolvedArtifactImpl / MavenArtifactInfoImpl
by Michal Matloka (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-190?page=com.atlassian.jira.plu... ]
Michal Matloka updated SHRINKRES-190:
-------------------------------------
Assignee: (was: Michal Matloka)
> implements equals and hashCode methods in MavenResolvedArtifactImpl / MavenArtifactInfoImpl
> -------------------------------------------------------------------------------------------
>
> Key: SHRINKRES-190
> URL: https://issues.jboss.org/browse/SHRINKRES-190
> Project: ShrinkWrap Resolvers
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Affects Versions: 2.1.1
> Reporter: Mathieu Lachance
> Fix For: 2.2.0-alpha-3
>
>
> I'm currently to find an effective way to filter out many dependencies at once that I could provide within a "dummy" pom.xml.
> I'd like to do the following:
> {code:java}
> public static List<MavenResolvedArtifact> resolveAllTestNonTransitiveDependencies() {
> return Arrays.asList(
> Maven.resolver()
> .loadPomFromFile("pom.xml")
> .importTestDependencies().resolve()
> .withoutTransitivity()
> .asResolvedArtifact());
> }
>
> public static List<MavenResolvedArtifact> resolveAllArquillianDependencies() {
> return Arrays.asList(
> Maven.resolver()
> .loadPomFromFile("src/test/resources/arquillian.pom.xml")
> .importTestDependencies().resolve()
> .withoutTransitivity()
> .asResolvedArtifact());
> }
>
> public static List<MavenResolvedArtifact> resolveAllTestNonTransitiveNonArquillianDependencies() {
> List<MavenResolvedArtifact> testDependencies = resolveAllTestNonTransitiveDependencies();
>
> List<MavenResolvedArtifact> arquillianDependencies = resolveAllArquillianDependencies();
>
> List<MavenResolvedArtifact> filteredTestDependencies = new ArrayList<MavenResolvedArtifact>();
> for (MavenResolvedArtifact testDependency : testDependencies) {
> if (!arquillianDependencies.contains(testDependency)) {
> filteredTestDependencies.add(testDependency);
> }
> }
> return filteredTestDependencies;
> }
> {code}
> The problem is that MavenResolvedArtifactImpl does not implements equals and hashCode needed for using Collection::contains method.
> I think it would be safe to delegate MavenResolvedArtifactImpl / MavenArtifactInfoImpl equals and hashCode methods to the one defined in MavenCoordinateImpl
> Thanks,
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 7 months
[JBoss JIRA] (SHRINKRES-190) implements equals and hashCode methods in MavenResolvedArtifactImpl / MavenArtifactInfoImpl
by Michal Matloka (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-190?page=com.atlassian.jira.plu... ]
Michal Matloka reassigned SHRINKRES-190:
----------------------------------------
Assignee: Michal Matloka
> implements equals and hashCode methods in MavenResolvedArtifactImpl / MavenArtifactInfoImpl
> -------------------------------------------------------------------------------------------
>
> Key: SHRINKRES-190
> URL: https://issues.jboss.org/browse/SHRINKRES-190
> Project: ShrinkWrap Resolvers
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Affects Versions: 2.1.1
> Reporter: Mathieu Lachance
> Assignee: Michal Matloka
> Fix For: 2.2.0-alpha-3
>
>
> I'm currently to find an effective way to filter out many dependencies at once that I could provide within a "dummy" pom.xml.
> I'd like to do the following:
> {code:java}
> public static List<MavenResolvedArtifact> resolveAllTestNonTransitiveDependencies() {
> return Arrays.asList(
> Maven.resolver()
> .loadPomFromFile("pom.xml")
> .importTestDependencies().resolve()
> .withoutTransitivity()
> .asResolvedArtifact());
> }
>
> public static List<MavenResolvedArtifact> resolveAllArquillianDependencies() {
> return Arrays.asList(
> Maven.resolver()
> .loadPomFromFile("src/test/resources/arquillian.pom.xml")
> .importTestDependencies().resolve()
> .withoutTransitivity()
> .asResolvedArtifact());
> }
>
> public static List<MavenResolvedArtifact> resolveAllTestNonTransitiveNonArquillianDependencies() {
> List<MavenResolvedArtifact> testDependencies = resolveAllTestNonTransitiveDependencies();
>
> List<MavenResolvedArtifact> arquillianDependencies = resolveAllArquillianDependencies();
>
> List<MavenResolvedArtifact> filteredTestDependencies = new ArrayList<MavenResolvedArtifact>();
> for (MavenResolvedArtifact testDependency : testDependencies) {
> if (!arquillianDependencies.contains(testDependency)) {
> filteredTestDependencies.add(testDependency);
> }
> }
> return filteredTestDependencies;
> }
> {code}
> The problem is that MavenResolvedArtifactImpl does not implements equals and hashCode needed for using Collection::contains method.
> I think it would be safe to delegate MavenResolvedArtifactImpl / MavenArtifactInfoImpl equals and hashCode methods to the one defined in MavenCoordinateImpl
> Thanks,
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 7 months
[JBoss JIRA] (SHRINKRES-186) MavenResolverSystemBase deprecates offline() but JavaDoc refer to wrong new usage
by Michal Matloka (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-186?page=com.atlassian.jira.plu... ]
Michal Matloka updated SHRINKRES-186:
-------------------------------------
Status: Pull Request Sent (was: Open)
Git Pull Request: https://github.com/shrinkwrap/resolver/pull/70
> MavenResolverSystemBase deprecates offline() but JavaDoc refer to wrong new usage
> ----------------------------------------------------------------------------------
>
> Key: SHRINKRES-186
> URL: https://issues.jboss.org/browse/SHRINKRES-186
> Project: ShrinkWrap Resolvers
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: api-maven
> Affects Versions: 2.1.1
> Reporter: Aslak Knutsen
> Assignee: Michal Matloka
> Fix For: 2.2.0-alpha-3
>
>
> MavenResolverSystemBase deprecates the methods offline() and offline(boolean), but the JavaDoc suggests the new way to set this flag is via ConfigurableMavenResolverSystem#workOffline(). The link is correct, but the suggest path seems off; Maven.resolver().workOffline()
> Maven.resolver() will return a MavenResolverSystem, while Maven.configureResolver() returns the ConfigurableMavenResolverSystem which has the new methods..
> Either the JavaDoc needs update, or the Maven.resolver() methods needs to return the new interface?
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 7 months
[JBoss JIRA] (SHRINKRES-186) MavenResolverSystemBase deprecates offline() but JavaDoc refer to wrong new usage
by Michal Matloka (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-186?page=com.atlassian.jira.plu... ]
Michal Matloka reassigned SHRINKRES-186:
----------------------------------------
Assignee: Michal Matloka
> MavenResolverSystemBase deprecates offline() but JavaDoc refer to wrong new usage
> ----------------------------------------------------------------------------------
>
> Key: SHRINKRES-186
> URL: https://issues.jboss.org/browse/SHRINKRES-186
> Project: ShrinkWrap Resolvers
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: api-maven
> Affects Versions: 2.1.1
> Reporter: Aslak Knutsen
> Assignee: Michal Matloka
> Fix For: 2.2.0-alpha-3
>
>
> MavenResolverSystemBase deprecates the methods offline() and offline(boolean), but the JavaDoc suggests the new way to set this flag is via ConfigurableMavenResolverSystem#workOffline(). The link is correct, but the suggest path seems off; Maven.resolver().workOffline()
> Maven.resolver() will return a MavenResolverSystem, while Maven.configureResolver() returns the ConfigurableMavenResolverSystem which has the new methods..
> Either the JavaDoc needs update, or the Maven.resolver() methods needs to return the new interface?
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 7 months
[JBoss JIRA] (SHRINKRES-194) Multi-module gradle project support
by Karel Piwko (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-194?page=com.atlassian.jira.plu... ]
Karel Piwko updated SHRINKRES-194:
----------------------------------
Status: Resolved (was: Pull Request Sent)
Resolution: Done
> Multi-module gradle project support
> -----------------------------------
>
> Key: SHRINKRES-194
> URL: https://issues.jboss.org/browse/SHRINKRES-194
> Project: ShrinkWrap Resolvers
> Issue Type: Requirement
> Security Level: Public(Everyone can see)
> Affects Versions: 2.2.0-alpha-2
> Reporter: Michal Matloka
> Assignee: Michal Matloka
> Fix For: 2.2.0-alpha-3
>
>
> Issue from github https://github.com/mmatloka/arquillian-gradle-sample/issues/1:
> {quote}
> Hi,
> I'm very glad for your gradle resolver. However, we have multi project setup in which this code fails with an ArrayIndexOutOfBoundException
> {code}
> final GradleProject gradleProject = projectConnection.getModel(GradleProject.class);
> final File buildDir = new File(projectDir, "build");
> final File libsDir = new File(buildDir, "libs");
> final File result = libsDir.listFiles(new FilenameFilter() {
> @Override
> public boolean accept(final File dir, final String name) {
> return name.startsWith(gradleProject.getName());
> }
> })[0];
> {code}
> This is imho due to the fact that the gradleProject above holds the multi project but the arquillian tests are contained (and should be contained) in the sub project (*server). There the predicate will never be true and the [0] with end up in an exception.
> I think you can either do a deep search to also get the sub project jars or more accurately resolve the project the tests are in. If you need help let me know.
> Best,
> Maik
> {quote}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 7 months
[JBoss JIRA] (SHRINKRES-194) Multi-module gradle project support
by Karel Piwko (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-194?page=com.atlassian.jira.plu... ]
Karel Piwko edited comment on SHRINKRES-194 at 8/26/14 10:22 AM:
-----------------------------------------------------------------
Landed in https://github.com/shrinkwrap/resolver/commit/b14a8ad338c6677425e9d378896... . Thanks!
was (Author: kpiwko):
Fixed in https://github.com/shrinkwrap/resolver/commit/b14a8ad338c6677425e9d378896...
> Multi-module gradle project support
> -----------------------------------
>
> Key: SHRINKRES-194
> URL: https://issues.jboss.org/browse/SHRINKRES-194
> Project: ShrinkWrap Resolvers
> Issue Type: Requirement
> Security Level: Public(Everyone can see)
> Affects Versions: 2.2.0-alpha-2
> Reporter: Michal Matloka
> Assignee: Michal Matloka
> Fix For: 2.2.0-alpha-3
>
>
> Issue from github https://github.com/mmatloka/arquillian-gradle-sample/issues/1:
> {quote}
> Hi,
> I'm very glad for your gradle resolver. However, we have multi project setup in which this code fails with an ArrayIndexOutOfBoundException
> {code}
> final GradleProject gradleProject = projectConnection.getModel(GradleProject.class);
> final File buildDir = new File(projectDir, "build");
> final File libsDir = new File(buildDir, "libs");
> final File result = libsDir.listFiles(new FilenameFilter() {
> @Override
> public boolean accept(final File dir, final String name) {
> return name.startsWith(gradleProject.getName());
> }
> })[0];
> {code}
> This is imho due to the fact that the gradleProject above holds the multi project but the arquillian tests are contained (and should be contained) in the sub project (*server). There the predicate will never be true and the [0] with end up in an exception.
> I think you can either do a deep search to also get the sub project jars or more accurately resolve the project the tests are in. If you need help let me know.
> Best,
> Maik
> {quote}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 7 months