当我通过grails运行应用程序run-app一切都很好但是当我运行grails run-war我的jquery相关插件似乎已经消失了......我搞砸了什么?提前感谢所有的帮助。
buildconfig.groovy:
grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.work.dir = "target/work"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
// compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the test-app JVM, uses the daemon by default
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the run-app JVM
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the run-war JVM
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
mavenRepo "http://repo.grails.org/grails/core"
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
mavenRepo "http://repository.codehaus.org"
mavenRepo "http://download.java.net/maven/2/"
mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.29'
// runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
compile "commons-beanutils:commons-beanutils:1.8.3"
runtime "org.postgresql:postgresql:9.4-1201-jdbc41"
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.8'
compile ":asset-pipeline:2.4.3"
compile ':jquery-date-time-picker:0.2.0'
compile ":jquery-ui:1.10.4"
compile ":jquery-datatables:1.7.5"
compile ":csv:0.3.1"
compile ':spring-security-core:2.0-RC5'
compile ':quartz:1.0.1'
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
// Uncomment these to enable additional asset-pipeline capabilities
//compile ":sass-asset-pipeline:1.9.0"
//compile ":less-asset-pipeline:1.10.0"
//compile ":coffee-asset-pipeline:1.8.0"
//compile ":handlebars-asset-pipeline:1.3.0.3"
}
}
我的application.js
// This is a manifest file that'll be compiled into application.js.
//
// Any JavaScript file within this directory can be referenced here using a relative path.
//
// You're free to add application-wide JavaScript to this file, but it's generally better
// to create separate JavaScript files as needed.
//
//= require jquery
//= require js/jquery-ui-1.10.4.custom
//= require jquery-ui-timepicker-addon
//= require jquery.dataTables
//= require_tree .
//= require_self
if (typeof jQuery !== 'undefined') {
(function($) {
$('#spinner').ajaxStart(function() {
$(this).fadeIn();
}).ajaxStop(function() {
$(this).fadeOut();
});
})(jQuery);
}
$(document).ready(function() {
$( ".dateTimePicker" ).datepicker();
});
$( document ).ready(function() {
// bind DataTable on table ID
$('#defaultDataTable').dataTable( {
/* to increase the process and speed for loading data from server
* (check more properties if needed )
*/
"bProcessing": true,
"sPaginationType": "full_numbers",
"bPaginate": false,
"bDeferRender": true
});
$('#aircraftTable').dataTable( {
"bProcessing": true,
"sPaginationType": "full_numbers",
"bPaginate": false,
"bDeferRender": true,
"aoColumnDefs": [
{
"bSortable": false, "aTargets": [4,5],
"bSearchable": false, "aTargets": [4,5]
}
] } );
bindDataTable();
chosen();
bindDateTimePicker();
});
/* Chosen (select box - chosen) */
function chosen(){
if($('.chosen-select').length > 0){
$('.chosen-select').each(function(){
var $el = $(this);
var search = ($el.attr("data-nosearch") === "true") ? true : false,
opt = {};
if(search) opt.disable_search_threshold = 9999999;
$el.chosen(opt);
});
}
}
function bindDateTimePicker(){
/* date picker */
if($('.datepick').length > 0){
$('.datepick').datepicker();
}
/* date range picker */
if($('.daterangepick').length > 0){
$('.daterangepick').daterangepicker();
}
/* time picker */
if($('.timepick').length > 0){
$('.timepick').timepicker({
defaultTime: 'current',
minuteStep: 1,
disableFocus: true,
template: 'dropdown'
});
}
}
my main.gsp
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"><!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><g:layoutTitle default="Grails"/></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="${assetPath(src: 'favicon.ico')}" type="image/x-icon">
<link rel="apple-touch-icon" href="${assetPath(src: 'apple-touch-icon.png')}">
<link rel="apple-touch-icon" sizes="114x114" href="${assetPath(src: 'apple-touch-icon-retina.png')}">
<asset:stylesheet src="application.css"/>
<asset:javascript src="application.js"/>
<g:layoutHead/>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Base</a>
</div>
<ul class="nav navbar-nav">
<li><g:link controller="ScheduledEvent">Events</g:link></li>
<li><g:link controller="ScheduledEvent">ADS Record List</g:link></li>
<sec:ifAnyGranted roles="ROLE_ADMIN">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Admin <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><g:link controller="ScheduledEvent">Customer</g:link></li>
%{-- <li class="divider"></li>
<li class="dropdown-header">Security:</li>
<li><g:link controller="ScheduledEvent">Role</g:link></li>
<li><g:link controller="ScheduledEvent">User</g:link></li>
<li><g:link controller="ScheduledEvent">User/Role Assignment</g:link></li>--}%
</ul>
</li>
</sec:ifAnyGranted>
</ul>
<div id="navbar" class="navbar-collapse collapse">
<sec:ifNotLoggedIn>
<form class="navbar-form navbar-right" method="POST"action="${resource(file: 'j_spring_security_check')}">
<div class="form-group">
<input type="text" placeholder="Username" class="form-control" name='j_username' id='username'/>
</div>
<div class="form-group">
<input type="password" placeholder="Password" class="form-control" name='j_password' id='password'/>
</div>
<button type="submit" class="btn btn-success">Sign in</button>
</form>
</sec:ifNotLoggedIn>
<sec:ifLoggedIn>
<ul class="nav navbar-nav navbar-right">
<li><g:link controller="logout">[ Log Out ]</g:link></li>
</ul>
</sec:ifLoggedIn>
</div><!--/.navbar-collapse -->
</div>
</nav>
<g:layoutBody/>
<div class="footer" role="contentinfo"></div>
<div id="spinner" class="spinner" style="display:none;"><g:message code="spinner.alt" default="Loading…"/></div>
</body>
</html>
也注意到战争中的信息变化 非战争:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Scheduled Event List</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/base/assets/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="/base/assets/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="114x114" href="/base/assets/apple-touch-icon-retina.png">
<link rel="stylesheet" href="/base/assets/bootstrap.css?compile=false" />
<link rel="stylesheet" href="/base/assets/custom.css?compile=false" />
<link rel="stylesheet" href="/base/assets/jquery.dataTables.css?compile=false" />
<link rel="stylesheet" href="/base/assets/application.css?compile=false" />
<script src="/base/assets/jquery-1.11.3.min.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/jquery-ui.min.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/jquery.dataTables.min.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/affix.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/alert.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/button.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/carousel.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/collapse.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/dropdown.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/modal.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/popover.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/scrollspy.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/tab.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/tooltip.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/transition.js?compile=false" type="text/javascript" ></script>
<script src="/base/assets/application.js?compile=false" type="text/javascript" ></script>
<meta name="layout" content="main">
</head>
和战争的负责人
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Scheduled Event List</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/base/assets/favicon-9ef27019cc7a636e29ecc851528f716e.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="/base/assets/apple-touch-icon-c915103363017d14cea9c2a46ea12166.png">
<link rel="apple-touch-icon" sizes="114x114" href="/base/assets/apple-touch-icon-retina-21d524e96ee946f16c9b8fb4ea0c3f6e.png">
<link rel="stylesheet" href="/base/assets/application-05d0813af24ff9275b9df9f05c1db91d.css"/>
<script src="/base/assets/application-e2bb20b8d7511fca0d3d6620077bcc41.js" type="text/javascript" ></script>
<meta name="layout" content="main">
</head>