# Enabling Template repositories by default?

**URL:** https://bnd.discourse.group/t/enabling-template-repositories-by-default/460
**Category:** GENERAL
**Created:** [July 21, 2024, 7:20pm UTC](https://bnd.discourse.group/t/enabling-template-repositories-by-default/460 "2024-07-21T19:20:43Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![chrisrueger](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/chrisrueger/32/18_2.png) [@chrisrueger](https://bnd.discourse.group/u/chrisrueger)
#### Post date: [July 21, 2024, 7:20pm UTC](https://bnd.discourse.group/t/enabling-template-repositories-by-default/460/1 "2024-07-21T19:20:43Z")

</div>

Could we enable this setting by default?

 ![image](https://global.discourse-cdn.com/free1/uploads/bnd/original/1X/f5aa7b7bb5b8bb6572d7d06739cd0a9575ffe495.jpeg)

## Why?

I started fiddling with bndtools templates… and I couldn’t get it to show up in `"File / New / Bnd Osgi Project"`

until I found the sentence on [this site](https://mnlipp.github.io/osgi-getting-started/Bndtools.html#fn:templDefault) that an option needs to be enabled and the a “Eclipse restart is needed”:

> So open “Window/Preferences/Bndtools/Repositories”, “Enable templates repositories” and restart Eclipse[3](https://mnlipp.github.io/osgi-getting-started/Bndtools.html#fn:templDefault).

Only then the template shows up:

 ![image](https://global.discourse-cdn.com/free1/uploads/bnd/original/1X/998f8c25130f6ab493e64a5999c5112b947f789d.jpeg)

For further references: I found the following other pages with info about templates:

- [osgi.enroute.template/osgi.enroute.bndtools.templates/help.txt at master · osgi/osgi.enroute.template · GitHub](https://github.com/osgi/osgi.enroute.template/blob/master/osgi.enroute.bndtools.templates/help.txt)
- [https://groups.google.com/g/Bndtools-users/c/HSIVQHPzsZk?pli=1](https://groups.google.com/g/Bndtools-users/c/HSIVQHPzsZk?pli=1)

---

<div class="post-metadata">

### Author: ![chrisrueger](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/chrisrueger/32/18_2.png) [@chrisrueger](https://bnd.discourse.group/u/chrisrueger)
#### Post date: [July 22, 2024, 7:52am UTC](https://bnd.discourse.group/t/enabling-template-repositories-by-default/460/2 "2024-07-22T07:52:15Z")

</div>

Ah damn, I was wrong with my interpretation.  
The problem is not that the setting is disabled.

The problem **seems** that project templates in the workspace are only indexed when Eclipse is restarted / starts. In other words: When you create a new template project, you need to restart eclipse to use it.

I think the logic is in `org.bndtools.core.templating.repobased.ReposTemplateLoader.findTemplates(String, Reporter)` which is only triggered at eclipse startup. But maybe needs to be triggered when

- a new template project is created
- or when the `"File / New / Bnd Osgi Project"` wizard is opened.

---

<div class="post-metadata">

### Author: ![juergen-albert](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/juergen-albert/32/20_2.png) [@juergen-albert](https://bnd.discourse.group/u/juergen-albert)
#### Post date: [July 22, 2024, 8:11am UTC](https://bnd.discourse.group/t/enabling-template-repositories-by-default/460/3 "2024-07-22T08:11:36Z")

</div>

This is new. Usually you could see the result of any changes to a template in your Workspace immediately.

---

<div class="post-metadata">

### Author: ![chrisrueger](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/chrisrueger/32/18_2.png) [@chrisrueger](https://bnd.discourse.group/u/chrisrueger)
#### Post date: [July 22, 2024, 8:52am UTC](https://bnd.discourse.group/t/enabling-template-repositories-by-default/460/4 "2024-07-22T08:52:37Z")

</div>

> [@juergen-albert](#):
>
> changes to a template

Changes yes.

But if you create a new project template, it is only visible after Eclipse restart.

---

<div class="post-metadata">

### Author: ![chrisrueger](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/chrisrueger/32/18_2.png) [@chrisrueger](https://bnd.discourse.group/u/chrisrueger)
#### Post date: [July 22, 2024, 10:10am UTC](https://bnd.discourse.group/t/enabling-template-repositories-by-default/460/5 "2024-07-22T10:10:27Z")

</div>

Maybe it is that `bndtools.central.EclipseWorkspaceRepository.initialize(Workspace)` is just called once on Startup.

 ![image](https://global.discourse-cdn.com/free1/uploads/bnd/original/1X/cd9dd8463299c9e5054882b04b4c2d5112c1e2d1.jpeg)

And

```auto
private static final Supplier<EclipseWorkspaceRepository>	eclipseWorkspaceRepository	= Memoize
		.supplier(EclipseWorkspaceRepository::new);

```

in `Central` never gets refreshed.

---

<div class="post-metadata">

### Author: ![chrisrueger](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/chrisrueger/32/18_2.png) [@chrisrueger](https://bnd.discourse.group/u/chrisrueger)
#### Post date: [July 22, 2024, 12:57pm UTC](https://bnd.discourse.group/t/enabling-template-repositories-by-default/460/6 "2024-07-22T12:57:34Z")

</div>

I created PR [fix new project templates not showing up by chrisrueger · Pull Request #6191 · bndtools/bnd · GitHub](https://github.com/bndtools/bnd/pull/6191)
