How to use custom template repository? - typesafe-activator

Starting the activator with activator new you get a list of project seeds and you also can get templates. Is it possible to have one's own source/repository of seeds and templates or is there a possibility to configure to not use the typesafe ones?
I want to achieve something like this:
$~- activator new
Fetching the latest list of templates...
Browse the list of templates: http://my-templates
Choose from these featured templates or enter a template name:
1) My-Own-Seed
2) CompanyConfiguration
(hit tab to see a list of all templates)
I know of g8 but I don't want to use it because I like the tight integration with sbt of activator.
EDIT:
I found documentation at https://typesafe.com/activator/template/contribute but I'm not sure if I can achieve that the seeds are just usable within an enclosed environment.

Related

Generating Scala models from Swagger spec

I'm trying to build a Vert.X app using Scala, and generating the routes using an OpenAPI 3 spec through the OpenAPI3RouterFactory.
I need to generate the models described in my spec as Scala classes.
Is there any simple and straightforward way to accomplish this?
I'm using SBT to build my app, and I've already tried some sbt codegen plugins for Swagger, but none of them seem to work.
With vertx-web-api-contract, Router and validation handlers are generated at runtime, so you don't need to generate the routes. You can just start using the Router factory and mount the handlers you want as if it would be a Vert.x Web Router. If you want to bootstrap a new project there is a community tool called vertx-starter, but there is no Scala support now
Talking about the models, what you can do is organize your OpenAPI specification in different files, putting all data model definitions under a specific directory like spec/models (You can find a good guide here). Then you can configure jsonschema2pojo (sbt plugin) to generate a Scala case class for each schema inside that directory. Then, if you want to repack the spec in a single file, you can configure tools like swagger-cli to run during the compilation and pack the spec back in a single file

IntelliJ Scala "Package" not in "New" menu

I am using IntelliJ and would like to create a new Scala Package. In all of the instructions that I find online I see that I am supposed to select "Package" from the "New" menu. However, my "New" menu does not include "Package" as an option.
How can I add "Package" to this list or otherwise add a package to my Scala application?
Also as a side note, I am developing Scala applications and as such I would like for primarily Scala related templates to appear in this list as opposed to the menagerie or irrelevant templates that currently presents itself. How can I edit the list of templates that appears in this menu?
I solved this problem by taking the following steps:
Making sure to install both the Scala and SBT plugins. (I was missing the SBT plugin)
Copying all the source files (*.scala) into a temporary location
Deleting the project.
Creating a new project with the same structure and copying the source files into their proper location.
Now "Package" appears in the menu (and full syntax hilighting now works, which was the reason why I wanted to fix this in the first place). Note that simply installing the SBT plugin (step 1) was not sufficient in fix this problem.
Maybe it was a bug.

Is there a way to restrict the project drop down list when you bind an Eclipse project to a SonarQube project?

My Eclipse project is made up of about a dozen smaller projects.
My SonarQube dashboard shows the main project followed by the subprojects with a single line separation. They all share the same name, but hovering over the name will show the main project or the subproject (two hover examples) .
In Eclipse, when I want to bind my project, the list provided from the SonarQube server (Eclipse bind options screenshot) includes all the subprojects, but they all have the same name.
Is there a way to only show the main project in the bind list or have the subproject name be easier to find both in the bind list and the sonarqube project view?
Currently that's not possible, but it's a good idea.
We plan to implement it and I've created a ticket to track this feature, that you can follow/vote: https://jira.sonarsource.com/browse/SLE-94

Eclipse 4 RCP, is it possible to exclude/include extensions conditionally

I'm working on an Eclipse rcp application which is using a middle layer to request data. I want to run my application in offline mode i.e. if data service is not available I should be able to work on some dummy data. For this purpose I want to exclude/ include extensions (not extension points but extension point providers). Is that possible?
Thanks
If you put the live and test versions of the extension point implementation in different plugins you can then choose which plugins to include in the product build - so you would have two product configurations, one for testing and one for production. When you are testing in Eclipse you can configure the plugins to include in the Run Configuration, so again you would have a test and production configuration.
It might also be possible to use a plugin fragment to contain just the part which varies. Use New / Project / Plug-in Development / Fragment Project to create.

General questions about PDE programming

Here are two short, but hopefully good questions:
When to use plugins and when fragments?
What is a headless PDE build and when to use it (and when not)?
Fragments are for when you want to expand or alter the functionality of a plugin. A fragment cannot exist on it's own, it requires a parent plugin. The typical example of a fragment are for localizing a plugin, i.e to change strings to other languages. The fragment will then alter the functionality of the plugin to replace resources or code with the contents of the fragment.
More details here Tutorial here
The headless part means you do the build without a gui, i.e from commandline or from a tool such as jenkins/hudson. PDE stands for Plugin Development Environment. In short, it adds some tasks to Ant, and you can use the defined resources and dependencies in the plugin.xml to build. The alternative is to again define classpaths, sources, etc in an Ant build file.
I've used it in some projects and it has been difficult to setup properly, but its the best way to build Eclipse plugins or products. We wanted to use relative paths for the build and had major problems with that. The earlier in your project that you set up a continous headless PDE build, the easier it will be to configure.
More info here