-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-3437][BUILD] Support crossbuilding in maven. #2318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@pwendell If this is okay to do, then there is no need of a special maven plugin for this task. |
|
QA tests have started for PR 2318 at commit
|
|
QA tests have finished for PR 2318 at commit
|
This patch get rid of _2.10 in the artifact ids and adapts the install plugin to include it instead. This will make it easy to cross build for scala 2.10 and 2.11.
|
QA tests have started for PR 2318 at commit
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It goes without saying, but this introduces a sort of 'incompatibility' at the Maven level. Downstream projects have to change artifact and version when selecting between this and a future version with different artifact names. This doesn't automatically harmonize the Spark build with the version of Scala you're using, and Maven can't resolve dependency conflicts across differently named artifacts. These are kind of inevitable.
If an end goal is to publicly support Scala 2.10 and 2.11 simultaneously, then we still have to have several published artifacts at once right? this is what classifier could be used for. But I suppose it's worth asking if that's the intent? or is this going to may be happen all at once for Spark 2.x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sean I think this approach actually modifies the published pom's to look different than the poms which are our own build. I.e. it appends the 2.11 or 2.10 suffix to the artifact in the published poms. Other than being horrendously verbose... this does seem to be a nicer approach IMO.
Since donstream projects only consume spark via the published poms, it seems okay to me. What is the specific case you're concerned about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now. That makes sense then, and leaves open the possibility of publishing parallel builds for Scala 2.10 / 2.11 under the current naming convention. Although maybe you could argue for using classifier instead, there's no point changing conventions if they're not already being changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked the published pom had, just this inside it.
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.2.0-SNAPSHOT</version>
<description>POM was created from install:install-file</description>
</project>No dependency information, I am not sure if we can live without that.
|
QA tests have finished for PR 2318 at commit
|
|
I like this approach better than the previous one of modifying the maven build with bash - but I haven't tested it locally yet. I do wonder a bit about how this works in sbt (is this inherited for an |
|
@ScrapCodes the amount of copy & paste that Maven sometimes seem to enforce on people always boggles my mind... have you tried alternative approaches? I played a little bit with a couple of things and this approach seems to have made some progress: https://gist.github.com/vanzin/1ada891e573b89ff8c45 Namely, I saw the executions of the maven-install-plugin when building core/, and projects dependending on core were picking up the right dependency (with the scala version appended to the artifactId). |
|
@vanzin I have a feeling I'm missing something, but does this config need to be repeated more than once to begin with, instead of being defined in the parent once? Is it not going to work in this situation given what the plugin is trying to do with the artifact ID? |
|
@srowen the problem is that maven is stup... err, peculiar. If you declare the plugin in the parent pom's "pluginManagement" section, it will try to execute the plugin when building the parent pom itself. Since the parent pom has packaging "pom", it will fail, since there are no jars. So you need a way to only add the plugin to the build in certain situations. The logical thing would have the plugin only be activated for children, but there's no option I can find to do that. The next would be to only bind the plugin to a certain packaging type, but again, no dice. So you have to resort to profiles. You could have a profile activated by a property, but then that doesn't work when the property is set in the child pom (instead of the command line). So you're left with checking for some file on disk, like my approach. I checked for "src/main/scala", but if that's too generic, we can use a tag file (and create that file in all projects where we want the plugin to be activated). |
|
@vanzin I'm not suggesting putting it in |
That's what I meant. If you do that, it will be executed for the "spark_parent" pom and will fail. (BTW that's the first thing I tried.) |
|
pluginManagement by itself never activates a plugin. But crumbs I suppose
|
|
I don't see a "skip" config option for the install-file goal, but if it exists / works, sure, that's an option. |
|
@vanzin So yeah, it doesn't have a
The idea is that you can't avoid the plugin being active but can wait to connect the |
|
Hey All, |
|
If there's no way for the maven-install-plugin to fix the existing pom (instead of generating a minimal pom with no dependencies), then I guess I don't see any other solution. (If only you could use properties in the artifactId declaration...) |
|
#2357 Does this with the help of a custom maven plugin. |
This patch get rid of _2.10 in the artifact ids and adapts the install plugin to include it instead.
This will make it easy to cross build for scala 2.10 and 2.11.
There was no way(I know) to avoid copying the same code everywhere. (Maven oddities... )