You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@yetus.apache.org by "Priyank Bagrecha (Jira)" <ji...@apache.org> on 2019/11/23 18:54:00 UTC
[jira] [Commented] (YETUS-897) Incorrect usage of Maven profile
[ https://issues.apache.org/jira/browse/YETUS-897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16980852#comment-16980852 ]
Priyank Bagrecha commented on YETUS-897:
----------------------------------------
{code:java}
> Could not resolve org.apache.yetus:audience-annotations:0.11.0.
Required by:
project : > org.apache.parquet:parquet-common:1.11.0-SNAPSHOT
> Could not resolve org.apache.yetus:audience-annotations:0.11.0.
> Could not parse POM /Users/pbagrecha/.m2/repository/org/apache/yetus/audience-annotations/0.11.0/audience-annotations-0.11.0.pom
> Unable to resolve version for dependency 'jdk.tools:jdk.tools:jar'
> Could not resolve org.apache.yetus:audience-annotations:0.11.0.
> Could not parse POM https://repo1.maven.org/maven2/org/apache/yetus/audience-annotations/0.11.0/audience-annotations-0.11.0.pom
> Unable to resolve version for dependency 'jdk.tools:jdk.tools:jar'
> Could not resolve org.apache.yetus:audience-annotations:0.11.0.
> Could not parse POM https://jcenter.bintray.com/org/apache/yetus/audience-annotations/0.11.0/audience-annotations-0.11.0.pom
> Unable to resolve version for dependency 'jdk.tools:jdk.tools:jar'{code}
issue goes away when i delete this section in the pom locally
{code}
<dependencies>
<dependency>
<!-- Version and location set in project pom -->
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<scope>system</scope>
<!-- Mark as optional so that it isn't taken transitively -->
<optional>true</optional>
</dependency>
</dependencies>
{code}
> Incorrect usage of Maven profile
> --------------------------------
>
> Key: YETUS-897
> URL: https://issues.apache.org/jira/browse/YETUS-897
> Project: Yetus
> Issue Type: Bug
> Components: Audience Annotations
> Reporter: Martin Todorov
> Priority: Major
>
> Hi,
> A transitive dependency of our Gradle project requires {{compile group: 'org.apache.yetus', name: 'audience-annotations', version: '0.10.0'}}. It appears we may be hitting a [bug in Gradle|https://github.com/gradle/gradle/issues/10058] in that it quite possibly doesn't handle {{system}}-scoped and {{optional}} dependencies properly.
> I had a look at your project's {{pom.xml}} files and there are actually issues with it as well.
> Consider the following snippet:
> {code:java}
> <profiles>
> <profile>
> <id>jdk1.8</id>
> <activation>
> <jdk>(,1.8]</jdk>
> </activation>
> <dependencies>
> <dependency>
> <!-- Version and location set in project pom -->
> <groupId>jdk.tools</groupId>
> <artifactId>jdk.tools</artifactId>
> <scope>system</scope>
> <!-- Mark as optional so that it isn't taken transitively -->
> <optional>true</optional>
> </dependency>
> </dependencies>
> </profile>
> </profiles>
> <dependencies>
> <dependency>
> <!-- Version and location set in project pom -->
> <groupId>jdk.tools</groupId>
> <artifactId>jdk.tools</artifactId>
> <scope>system</scope>
> <!-- Mark as optional so that it isn't taken transitively -->
> <optional>true</optional>
> </dependency>
> </dependencies>
> {code}
> What's the point in both having the {{jdk.tools}} dependencies define in a profile and then also in the main {{<dependencies/>}} section? If you move this dependency into the profile and remove the one from the main {{<dependencies/>}} section, and make the profile activated via a system property, or activate it through your {{settings.xml}} via the {{activeProfile}} section, this should be okay.
> I agree that theoretically, this is bad Maven practice, because it breaks build portability, but on the other hand, you're already breaking build portability by declaring a {{system}}-scoped dependency.
> Is it really necessary to depend on the {{tools.jar}}? If you're using a JDK to build the code, you should always have it on your classpath? What seems to be the issue that you're trying to solve, (which I appear to be missing)?
> I haven't gone through all of your project's {{pom.xml}} files, but I suspect the same fix might be required elsewhere as well.
> Please, advise!
> Many thanks in advance!
> Kind regards,
> Martin
--
This message was sent by Atlassian Jira
(v8.3.4#803005)