Skip to content

Commit

Permalink
Merge pull request wakaleo#125 from faissalwise/bower
Browse files Browse the repository at this point in the history
moving from Webjars to Bower wakaleo#83
  • Loading branch information
arey committed Jan 30, 2016
2 parents a768e87 + 540d31e commit 4803b71
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "src/main/webapp/bower_components"
}
11 changes: 11 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "spring-petclinic",
"authors": [
"[email protected]"
],
"dependencies": {
"bootstrap": "~2.3.0",
"jquery": "~2.0.3",
"jquery-ui": "~1.10.3"
}
}
49 changes: 29 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
<mysql-driver.version>5.1.36</mysql-driver.version>

<!-- Web dependencies -->
<webjars-bootstrap.version>2.3.0</webjars-bootstrap.version>
<webjars-jquery-ui.version>1.10.3</webjars-jquery-ui.version>
<webjars-jquery.version>2.0.3-1</webjars-jquery.version>
<dandelion.version>1.1.1</dandelion.version>
<dandelion.datatables.version>1.1.0</dandelion.datatables.version>

Expand Down Expand Up @@ -223,23 +220,7 @@
</exclusion>
</exclusions>
</dependency>
<!-- Webjars (static dependencies distributed as JAR files) -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>${webjars-bootstrap.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery-ui</artifactId>
<version>${webjars-jquery-ui.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>${webjars-jquery.version}</version>
</dependency>


<!-- Test Artifacts -->
<dependency>
<groupId>org.springframework</groupId>
Expand Down Expand Up @@ -408,6 +389,34 @@
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>bower-install</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>bower</executable>
<arguments>
<argument>install</argument>
</arguments>
<workingDirectory>${basedir}</workingDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<url>demopetclinic</url>
</project>
3 changes: 0 additions & 3 deletions src/main/resources/spring/mvc-core-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
(see header.jsp for more details) -->
<mvc:resources mapping="/resources/**" location="/resources/"/>

<!-- uses WebJars so Javascript and CSS libs can be declared as Maven dependencies (Bootstrap, jQuery...) -->
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>

<mvc:view-controller path="/" view-name="welcome"/>

<!-- serve static resources (*.html, ...) from src/main/webapp/
Expand Down
12 changes: 5 additions & 7 deletions src/main/webapp/WEB-INF/jsp/fragments/staticFiles.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,23 @@ PetClinic :: a Spring Framework demonstration
<title>PetClinic :: a Spring Framework demonstration</title>


<spring:url value="/webjars/bootstrap/2.3.0/css/bootstrap.min.css" var="bootstrapCss"/>
<spring:url value="/bower_components/bootstrap/docs/assets/css/bootstrap.css" var="bootstrapCss"/>
<link href="${bootstrapCss}" rel="stylesheet"/>

<spring:url value="/resources/css/petclinic.css" var="petclinicCss"/>
<link href="${petclinicCss}" rel="stylesheet"/>

<spring:url value="/webjars/jquery/2.0.3/jquery.js" var="jQuery"/>
<spring:url value="/bower_components/jquery/jquery.js" var="jQuery"/>
<script src="${jQuery}"></script>

<!-- jquery-ui.js file is really big so we only load what we need instead of loading everything -->
<spring:url value="/webjars/jquery-ui/1.10.3/ui/jquery.ui.core.js" var="jQueryUiCore"/>
<spring:url value="/bower_components/query-ui/ui/jquery.ui.core.js" var="jQueryUiCore"/>
<script src="${jQueryUiCore}"></script>

<spring:url value="/webjars/jquery-ui/1.10.3/ui/jquery.ui.datepicker.js" var="jQueryUiDatePicker"/>
<spring:url value="/bower_components/query-ui/ui/jquery.ui.datepicker.js" var="jQueryUiDatePicker"/>
<script src="${jQueryUiDatePicker}"></script>

<!-- jquery-ui.css file is not that big so we can afford to load it -->
<spring:url value="/webjars/jquery-ui/1.10.3/themes/base/jquery-ui.css" var="jQueryUiCss"/>
<spring:url value="/bower_components/query-ui/themes/base/jquery.ui.base.css" var="jQueryUiCss"/>
<link href="${jQueryUiCss}" rel="stylesheet"></link>
</head>


2 changes: 1 addition & 1 deletion src/test/jmeter/petclinic_test_plan.jmx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/webjars/jquery/2.0.3/jquery.js</stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/bower_components/jquery/jquery.js</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
Expand Down

0 comments on commit 4803b71

Please sign in to comment.