Skip to content
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

Exactly how to use this plugin #2

Closed
delorum opened this issue Mar 25, 2013 · 6 comments
Closed

Exactly how to use this plugin #2

delorum opened this issue Mar 25, 2013 · 6 comments
Labels

Comments

@delorum
Copy link

delorum commented Mar 25, 2013

Hi!

Please, provide more info on how to use your plugin. I did what it says in Usage section for single module maven projects but with no luck.

I add
addSbtPlugin("com.github.shivawu" % "sbt-maven-plugin" % "0.1.0")
to project/plugins.sbt

Then I run sbt and it print:
$ sbt
[info] Loading project definition from /mypath/myproject/project
[info] Updating {file:/hmypath/myproject/project/}default-e07e35...
[info] Resolving org.scala-sbt#precompiled-2_10_0;0.12.2 ...
[info] Done updating.
[info] Loading [pom.xml]
[success] POM definition loaded
[info] Set current project to default-3d2470 (in build file:/mypath/myprject/)

Then I type update:

update
[info] Updating {file:/mypath/myproject/}default-3d2470...
[info] Resolving org.scala-lang#scala-library;2.9.1 ...
[info] Done updating.
[success] Total time: 0 s, completed 25.03.2013 17:50:20

Then I type compile:

compile
[info] Compiling 23 Scala sources to /mypath/myproject/target/scala-2.9.1/classes...
[error] /mypath/myproject/src/main/scala/ru/ipsoft/statserver/AppProperties.scala:5: object weiglewilczek is not a member of package com
[error] import com.weiglewilczek.slf4s.Logger
[error] ^
... lots of compilation errors below ...

So compilation fails and it seems it cannot resolve dependencies. Also I don't know how to access artifactId, version and other maven stuff from sbt. Maybe I should also add something to build.sbt or any other place?

@zen0wu
Copy link
Owner

zen0wu commented Apr 7, 2013

Hi @dunnololda Sorry for the inconvenient. The plugin is still young, and may have some bugs.

About your situation, you can type show library-dependencies on sbt console to see if the correct
dependencies are imported. If not, maybe there're some bugs in the plugin, and please tell me which artifact is wrong if allowed.

Thanks.

@delorum
Copy link
Author

delorum commented Apr 10, 2013

Hi shivawu!
Ok, here is one of my maven projects I test your plugin on:
https://github.com/dunnololda/scala-cli
You can clone it and do the same things.
Here is what I doing:
In scala-cli folder I create the folder project:
$ mkdir project
$ cd project

Then I create plugins.sbt file in it and add the plugin definition to this file:
$ cat project/plugins.sbt
addSbtPlugin("com.github.shivawu" % "sbt-maven-plugin" % "0.1.0")

Then here is the sbt output:
$ sbt
[info] Loading project definition from /home/andrey/java/workspace-scala/scala-cli/project
[info] Loading [pom.xml]
[success] POM definition loaded
[info] Set current project to default-36153a (in build file:/home/andrey/java/workspace-scala/scala-cli/)

show library-dependencies
[info] List(org.scala-lang:scala-library:2.9.2)
compile
[info] Compiling 5 Scala sources to /home/andrey/java/workspace-scala/scala-cli/target/scala-2.9.2/classes...
[error] /home/andrey/java/workspace-scala/scala-cli/src/main/scala/com/github/dunnololda/cli/MySimpleLogger.scala:3: object slf4j is not a member of package org
[error] import org.slf4j.LoggerFactory
[error] ^
[error] one error found
error Compilation failed
[error] Total time: 4 s, completed 10.04.2013 13:11:41

So where are all the dependencies?) Sbt version: 0.12.3

@zen0wu zen0wu closed this as completed in 967a528 Apr 10, 2013
@zen0wu
Copy link
Owner

zen0wu commented Apr 10, 2013

I've fixed the bug(it's very stupid, shame on me) and released another version.

However, there're some other problems in your project, like your artifact id has properties in it, which is not considered yet by this plugin right now.

I'll fix this maybe tomorrow, there're still some testing work to do.

@delorum
Copy link
Author

delorum commented Apr 10, 2013

However, there're some other problems in your project, like your artifact id has properties in it, which is not considered yet by this plugin right now.

In my another project where artifactId has no properties included, version 0.1.1 works fine (compilation works). Although, "show library-dependencies" shows only scala:

show library-dependencies
[info] List(org.scala-lang:scala-library:2.9.2)

Is it correct? In my dependencies list I also have casbah, akka and serveral other libraries.

In scala-cli sbt fails to start:
$ sbt
[info] Loading project definition from /home/andrey/java/workspace-scala/scala-cli/project
[info] Loading [pom.xml]
[info] Use pom.xml automatically
[info] Loading maven settings from /home/andrey/.m2/settings.xml
[error] sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

Is it because of artifactId with properties? If you can fix it pls do, as this way to compile scala libraries for many scala versions is very convenient (and compatible with sbt's %%).

@zen0wu
Copy link
Owner

zen0wu commented Apr 11, 2013

  1. I tried some of your projects and they all worked ok(except for one, which maven doesn't succeed to compile), and show library-dependencies on each project works ok. If it only shows scala-library, there're definitely some problems, but I didn't manage to reproduce it, maybe cause I'm using my current snapshot version.
  2. About the properties in artifact, if you type l when the error occurs, you can see that's the reason. And yes, it can be fixed, but now I only come up with a workaround, with the limitation of that it can only resolve properties WITHOUT inheritance. If you define your property in the parent pom, it will not be resolved.
    Maven will give a warning about property in artifact id, so it's not supposed to use that way. And, with this plugin, you don't need the scala version in the artifact id, you can just set crossScalaVersions in build.sbt, and sbt will do that for you, I think that's the correct way to archive this.
  3. You can try my snapshot version(0.1.2-SNAPSHOT) by now(add sonatype snapshot repository to your pom.xml), the relase version will be released in 1-2 days.

@zen0wu
Copy link
Owner

zen0wu commented Apr 14, 2013

@dunnololda I've released a 0.1.2, try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants