Is it possible for a Gradle plugin to resolve an artifact on its own? I know that in Maven, plugins can inject the Aether RepositorySystem and use that to download artifacts (That's how the Appengine Maven Plugin downloads the Appengine SDK). Is there similar functionality in Gradle?
I don't know what exactly you are trying to achieve but there are two things you could do when it comes to adding artifacts to a project with a plugin:
simply add the dependency you wish to be resolved to one of project's configurations using the plugin and let Gradle resolve it for you
add a custom configuration and do whatever you need to do with the resolved artifact, just like gradle gae plugin does for downloading gae sdk here and here
Related
I have seen many examples kie-maven-plugin using maven. But i want to know how to make a plugin kie-maven-plugin in gradle project. Seems like that plugin is not avilable in gradle core plugin. I appriciate if someone share github project link
I am new to gradle and most of my existing projects are in ant (netbeans projects).
Do I have to create gradle project for each of those projects that I would want to reuse?
Can I straightaway declare existing netbeans projects as dependencies in my gradle project? If yes, how?
Thanks.
The simplest approach is to add a dependency on files produced by Ant build (they are usually in build/dist). This would be similar to Gradle dependencies with file directories
Better solution is to start using repository manager: Ivy, Artifactory, Nexus. Then update your NetBeans projects to publish built artifacts into this repository and your Gradle projects can easily refer to them. Check for more details in http://gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
I am trying to use Gradle for my Java project. However, it does not automatically build like when I use Maven. Which plugins and settings should I use?
You could use the Gradle Eclipse plugin: http://gradle.org/docs/current/userguide/eclipse_plugin.html
If you are starting your project, maybe you could try STS: http://spring.io/tools/sts
There appears to be an Eclipse plugin for Gradle, but no Gradle plugin for Eclipse...
Simply, I'd like to add a build.gradle to my Eclipse project, write its contents (including defining its dependencies), and then run it from inside Eclipse, the same way I can run Ant scripts from inside Eclipse.
When it runs, I'd expect the plugin to pull down all dependencies and make them available to my project's classpath in Eclipse.
If no such plugin exists, then I ask: what's the best way to develop in Eclipse, but keep your builds managed by Gradle? If I decide I need a new xyz.jar as a dependency for my code, how do I add it as a dependency in such a way that both Gradle and Eclipse will recognize it (and not throw compiler errors)?
Either use the IDE project generation approach (gradle eclipse), or use the Eclipse Gradle Integration. In both cases, you'll want to apply plugin: "eclipse".
The Gradle plugin for Eclipse is part of the Spring IDE. It understands the dependencies specified in the build script and makes those available in the .classpath.
I have an OSGi bundle which is in Eclipse IDE represented as Eclipse Plug-in Project. The only way I found to satisfy the dependencies of this plug-in/bundle is to
1) import all dependencies (.jar files) through File > Import... > Plug-ins and Fragments wizard
2) and then declare the imported dependencies in MANIFEST.MF
Yes, this solution works, but on the other hand after I commit the changes to our repository all my team mates also have to manually import dependencies to Eclipse to fix the compilation errors.
QUESTION:
Is there a solution which does not require such irritating steps? I just want to pull the changes from repository and continue my work without need to fix the dependecies in MANIFEST.MF again and again...
P.S.: To retrieve dependencies we use Apache Ivy.
You need to set up a target platform in Eclipse. I find the easiest way is to put all the dependencies in a folder, and save the target platform as a .target file which I check into source control. Then the only steps my colleagues need to do is retrieve the dependencies and configure Eclipse to use the shared target definition. If we add new dependencies to the definition Eclipse will automatically pick up the changes with a restart or target platform refresh.
The Eclipse documentation should get you started: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.pde.doc.user/concepts/target.htm
If you develop server based applications then it is much better to let maven or Ivy manage the dependencies and use the maven bundle plugin to generate the Manifest. So you can avoid the Eclipse OSGi mode and the target platform. See http://www.liquid-reality.de/x/DIBZ for a tutorial how to develop OSGi bundles using maven and deploy on Apache Karaf. For Ivy you may have to use a slightly different build but the basics should be the same.