ceylon / ceylon-maven-plugin

Ceylon Maven plugin for compiling/running ceylon from Maven
Apache License 2.0
8 stars 4 forks source link

Support install target #14

Closed FroMage closed 7 years ago

FroMage commented 7 years ago

Right now, if I do mvn install I get my Ceylon module compiled, but then I get an empty jar installed:

[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /home/stephane/src/java-eclipse/my-app/module-ceylon/target/ceylon-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ ceylon ---
[INFO] Installing /home/stephane/src/java-eclipse/my-app/module-ceylon/target/ceylon-1.0-SNAPSHOT.jar to /home/stephane/.m2/repository/com/mycompany/app/ceylon/1.0-SNAPSHOT/ceylon-1.0-SNAPSHOT.jar
[INFO] Installing /home/stephane/src/java-eclipse/my-app/module-ceylon/pom.xml to /home/stephane/.m2/repository/com/mycompany/app/ceylon/1.0-SNAPSHOT/ceylon-1.0-SNAPSHOT.pom

I think we should hook into the install phase to install the compiled .car and probably use the pom that is inside the .car.

Which pom.xml to use to publish the module is tricky: the pom.xml written by the user doesn't need to have its dependencies correctly set, since they're declared in module.ceylon, but the rest of the info is valid: groupId, artifactId, etc…

The generated pom.xml inside the .car has valid dependencies but generated groupId/artifactId and such.

So ATM both are problematic. Either the plugin should verify that the dependencies are in sync. Or the compiler. The IDE could sync both files. Or we forget about syncing deps, and we add a compiler flag to point to our pom.xml so that it will fetch missing info from there, such as groupId, artifactId, parent and fill in the dependencies by itself.

I think that last option is saner and will lead to more correct pom.xml files, no?

vietj commented 7 years ago

why don't you use an option of the plugin to configure that ?

FroMage commented 7 years ago

Which option would that be?

vietj commented 7 years ago

when you mean install you mean install in maven repo a car file ?

FroMage commented 7 years ago

Yes.

FroMage commented 7 years ago

So the funny thing is that if I use explodeTo the generated jar is correct, even if slightly different to the .car because Maven adds metadata to the MANIFEST.MF file.

The only thing left to fix is the pom.xml, and for now I have added a check in the compile plugin that barfs if the dependencies list is different in the pom and Ceylon. When they are in sync, we can use the Herd Maven repo at https://modules.ceylon-lang.org/maven/1 to feed Maven modules for all the Ceylon modules to Maven.

I think this is the best way forward, but I'll need to tweak things in the Ceylon system so that:

FroMage commented 7 years ago

Done