0

I use Enunciate (http://enunciate.codehaus.org/) for our web-service layer and I just want to do something very simple but do not find any documentation.

I want to deploy some images and other static resources and to be accessible from e.g http://localhost:8080/myapp/images/img01.png

I tried to create a folder images under src/main/resources but it is not deployed like I want (all files/folder inside there goes to myapp/WEB-INF/classes, which as expected).

Someone can point me where are the static resources with the enunciate project?

I do not have the web.xml as it is automatically generated by the enunciate framework.

рüффп
  • 5,172
  • 34
  • 67
  • 113

2 Answers2

0

Static resources are structured using the standard project structure of the maven-war-plugin. So basically, you just put your image under src/main/webapp/images/img01.png.

Ryan Heaton
  • 1,173
  • 7
  • 11
  • Yes I know the standard way, but with enunciate projects we do not have the webapps folder anymore as main of the things are auto-generated (we use the maven-enunciate-spring-plugin as well). I want to know if there is another way than using a new plugin. – рüффп Jul 19 '13 at 13:41
  • There isn't a way to tell Enunciate to include an _additional_ set of static resources beyond what Enunciate includes by default. You _do_ have the option of specifying a documentation "base" to _replace_ the base that Enunciate uses. See the "base" attribute of docs module documented at http://enunciate.codehaus.org/module_docs.html#config – Ryan Heaton Aug 07 '13 at 20:02
  • That is not true, see my answer. Your link points to the generated documentation but I wanted the static resources like any other web app. – рüффп Aug 23 '13 at 07:29
0

In fact I found how to do it and I publish my solution as an answer

In our pom.xml, we refers the enunciate.xml path like this:

 <plugin>
    <groupId>org.codehaus.enunciate</groupId>
    <artifactId>maven-enunciate-spring-plugin</artifactId>
    <version>${enunciate.version}</version>
    <configuration>
        <configFile>src/conf/enunciate.xml</configFile>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>assemble</goal>
            </goals>
        </execution>
    </executions>
</plugin>

and in the enunciate.xml file:

<webapp postBase="web"></webapp>

which means the static resources can be put in src/conf/web/ and then my folder called images will simply located in: src/conf/web/images.

Like this all these static resources will be accessible by http://localhost:8080/myappcontext/images/

The enunciate documentation shows the option available for the webapp element:

  • preBase is a folder or zipped archive which will be copied before the enunciate generation
  • postBase is a folder of zipped archive which will be copied after the enunciate generation

For the images and other static resources there should not be any difference using one of these attributes.

рüффп
  • 5,172
  • 34
  • 67
  • 113