I have a scenario like this.
Currently i have a test artifact for some deployment related tasks. This test artifacts is bundled with testng classes to handle deployment. I have created a gradle task which is calling above testng class in gradle file. Since this is a reusable Component, i am asking all the engineers who want to deploy the product to copy the tasks to their test gradle files. Now that i want more control on this task, i want to package this as part of Plugin and let the engineers apply the plugin and import the task. Also plan is package the above test artifact with the plugin.
I don't see any working examples on this scenario while searching on google. Can anyone point me to such example.
The Gradle User Guide has a lengthy section on Writing Custom Plugins. It probably makes the most sense to start there.
Related
I am new to gradle composite builds. I have a multi-project build that uses precompiled script plugins in order to have tasks configured for all projects that include the plugin. Now I want to port that functionality to a composite build setup.
The screenshots below show how the current multi-project build works:
This java precompiled script plugin (/buildSrc/.../java-conventions.gradle.kts) configures the "JavaCompile" tasks (i.e. sourceCompatability, targetCompatability...).
This kotlin precompiled script plugin imports the java conventions plugin and configures the "KotlinCompile" tasks.
Applying the the kotlin conventions plugin to project "test" automagically sets up my project with the proper "JavaCompile" and "KotlinCompile" configuration as shown above.
I have read the official docs and tutorials on gradle composite builds. Still, I dont know the proper way how to do this with composite builds. Do I have to write standalone plugins for this? If so, can you provide a POC code snippet? Any advice is greatly appreciated!
I'm new to Gradle, as I'm reading the build scripts inside a large multi-project, I want to know which task is being introduced from which plugin.
As far as I'm aware, there is no easy plugin --> task reference.
If you use:
gradle help --task <task name>
You can see the type used to create the task. This could be useful for custom plugins where you have access to the source.
If you're wondering about the built-in Gradle plugins, your best bet is the User's Guide. For example, this section shows all of the tasks provided by the Java plugin.
I have only little experience using maven with eclipse. One of the job descriptions which I received has "Workflow management using Maven" as a required skill. What does this mean ? What do they possibly expect?
I think they want you to correct them? :D
I'm not sure what they refer to. I would guess it relates to the developer workflow of creating and delivering software with eclipse (?) and maven.
So setting up a project from scratch is often done from an maven archetype (a project template if you like). A lot of open source frameworks offer archetypes to start with.
For existing projects you would check out the code from version control and import it into eclipse. the m2eclipse plugin is required to do that (but I think its quite common to have it)
Then there is building the software. Which is done through executing maven phases (which will then execute plugins). See maven-phases for more details. Maven phases have default plugins that execute (for example compile will run the compiler plugin).
So your workflow would look like this: you modify the files. compile them, test them, package them, deploy the artifacts into the maven repository. the maven install phase will store the artifacts in you local repository, the maven deploy phase will upload them into the company's repository.
From there the the files are installed. Yet you can use maven plugins to install the software into a application server. That depends on the traditions of the company.
I would not think of workflow as some strict step by step think like BPMN. Development is usually done with huge amounts of personal practices (are tests written in advance or while implementing, and so on).
Hope that will help :)
Is there any maven plugin - or non-maven tool - out there which would browse a multi-modules project and return me a list of all existing JUnit testcases (ideally presented per module) in a usable form?
I want to be able to work on that list and distribute my tests across multiple hosts.
I checked surefire documentation and I'm surprised that it doesn't seem to be able to do that.
There's a .../target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst in a Maven project.
You can use the GMavenPlus Plugin and Walking the File Tree to gather these files and put their content where you want.
Another option is to develop an own Maven plugin that does the same.
I have a project, which is written using the Play Framework, say myproject-web. It is mostly a thin HTTP layer over another project, which forms the core of the entire business logic, called myproject-engine. In my build setup, myproject-web is a sbt project, whereas myproject-engine is a Gradle one.
What I want to achieve is that Play recognize myproject-engine as a dependency, and invoke gradle to build it whenever I try to build the play application (either on run, or automatically, as it happens in the dev mode) or when I do play dist. Is it possible? What is most important for me is that it automatically loads any dependencies that myproject-engine has.
Eventually, the state I want it to reach is that I host my Maven repo for these projects and then SBT can simply pull this package from over there and will get all its dependencies. Is this rather easy to setup? Even if it is, is it relatively easy to maintain?
As #Peter-Niederwieser pointed out in his comment, I think the only viable solution is to have a maven/ivy/gradle repository where the myproject-engine Gradle project is published to. With the correct resolvers the project becomes yet another project dependency, regardless of the build tool it uses.
See Resolvers in the official documentation of sbt.