tuplejump / play-yeoman

Play + Yeoman integration sbt and play plugins
Apache License 2.0
238 stars 57 forks source link

When I excuted result of deployments[dist, stage] , get a "Action not found' message #86

Closed kgcrom closed 5 years ago

kgcrom commented 8 years ago

"activator run" command works fine.

But I get below error when I executed results of 'dist' and 'stage' and I access '/ui', "activator start" has same error.

Action not found
For request 'GET /ui/'

I have modified some Gruntfile and structure.

/ui/modules/core      
/ui/modules/retention 
/ui/modules/search    
/ui/modules/trend     
/ui/modules/users

(each module has [config,css,services,controllers,directives,views, contstants] folders)

What is likely the cause of error?

Shiti commented 8 years ago

@kgcrom do you have a route defined for that path? In your case, something like,

GET    /ui     ...
kgcrom commented 8 years ago

Yes

GET         /ui                      com.tuplejump.playYeoman.Yeoman.index
->            /ui/                      yeoman.Routes

I wonder why "activator run" command works.

Gruntfile

'use strict';
module.exports = function(grunt) {
    // Unified Watch Object
    var watchFiles = {
        serverViews: ['app/views/**/*.*'],
        serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js'],
        clientViews: ['modules/**/views/**/*.html'],
        clientJS: ['js/*.js', 'modules/**/*.js'],
        clientCSS: ['modules/**/*.css']
    };

    // Project Configuration
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        watch: {
            index: {
                files: 'index.html',
                options: {
                    livereload: true
                }
            },
            serverViews: {
                files: watchFiles.serverViews,
                options: {
                    livereload: true
                }
            },
            serverJS: {
                files: watchFiles.serverJS,
                tasks: ['jshint'],
                options: {
                    livereload: true
                }
            },
            clientViews: {
                files: watchFiles.clientViews,
                options: {
                    livereload: true,
                }
            },
            clientJS: {
                files: watchFiles.clientJS,
                tasks: ['jshint', 'injector'],
                options: {
                    livereload: true
                }
            },
            clientCSS: {
                files: watchFiles.clientCSS,
                tasks: ['csslint', 'injector'],
                options: {
                    livereload: true
                }
            }
        },
        jshint: {
            all: {
                src: watchFiles.clientJS.concat(watchFiles.serverJS),
                options: {
                    jshintrc: true
                }
            }
        },
        csslint: {
            options: {
                csslintrc: '.csslintrc',
            },
            all: {
                src: watchFiles.clientCSS
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        'dist/{,*/}*',
                        '!dist/.git*'
                    ]
                }]
            }
        },
        ngAnnotate: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/concat',
                    src: '*/**.js',
                    dest: '.tmp/concat'
                }]
            }
        },
        env: {
            test: {
                NODE_ENV: 'test'
            },
            secure: {
                NODE_ENV: 'secure'
            }
        },
        injector: {
            options: {

            },
            // Inject application script files into index.html (doesn't include bower)
            scripts: {
                options: {
                    addRootSlash: false,
                    starttag: '<!-- injector:js -->',
                    endtag: '<!-- endinjector -->',
                    sort: function(a, b) {
                        return a.split('/').length - b.split('/').length;
                    }
                },
                files: {
                    'index.html': [
                        [
                            'config.js',
                            'application.js',
                            'modules/**/*.js',]
                    ]
                }
            },

            // Inject component css into index.html
            css: {
                options: {
                    addRootSlash: false,
                    starttag: '<!-- injector:css -->',
                    endtag: '<!-- endinjector -->',
                    sort: function(a, b) {
                        return (a.indexOf('reset')>0)? -1: 1;
                    }
                },
                files: {
                    'index.html': [
                        'modules/**/*.css'
                    ]
                }
            }
        },
        wiredep: {
            target: {
                src: [
                    'index.html'
                ],

                // Optional
                options: {
                    cwd: '',
                    dependencies: true,
                    devDependencies: false,
                    fileTypes: {},
                    overrides: {}
                }

            }
        },
        copy: {
            html: {
                options: {
                    process: function(content) {
                        return content.replace(/modules.{0,}img/g, 'img');
                    }
                },files: [{
                    expand: true,
                    dot: true,
                    cwd: '.',
                    dest: 'dist',
                    src: [
                        'modules/**/*.html',
                        'index.html'
                    ]
                }]
            },
            dist: {
                files: [{
                    expand: true,
                    flatten: true,
                    dest: 'dist/fonts',
                    src: ['lib/fontawesome/fonts/*'],
                    filter: 'isFile'
                },{
                    expand: true,
                    flatten: true,
                    dest: 'dist/img',
                    src: ['modules/**/*.{png,jpg,jpeg,gif,webp,svg}']
                }]
            }
        },
        useminPrepare: {
            html: ['index.html'],
            options: {
                dest: 'dist'
            }
        },

        rev: {
            dist: {
                files: {
                    src: [
                        'dist/app/*.js',
                        'dist/app/*.css',
                        'dist/fonts/*',
                        'dist/img/*'
                    ]
                }
            }
        },

        usemin: {
            html: ['dist/index.html', 'dist/modules/**/*/*.html'],
            css: ['dist/app/{,*/}*.css'],
            options: {
                assetsDirs: ['dist/**/']
            }
        },
        htmlmin: {
            dist: {
                options: {
                    collapseWhitespace: true,
                    conservativeCollapse: true,
                    collapseBooleanAttributes: true,
                    removeCommentsFromCDATA: true,
                    removeOptionalTags: true
                },
                files: [{
                    expand: true,
                    cwd: 'dist',
                    src: ['*.html', 'modules/**/*.html'],
                    dest: 'dist'
                }]
            }
        },
        karma: {
            unit: {
                configFile: 'karma.conf.js'
            }
        }
    });

    // Load NPM tasks
    require('load-grunt-tasks')(grunt);

    // Making grunt default to force in order not to break the project.
    grunt.option('force', true);

    // Default task(s).
    grunt.registerTask('default', [
        'lint',
        'injector',
        //'watch',    uncomment when I have executed "activator run"
        'wiredep'

    ]);

    // Debug task.
    grunt.registerTask('server', [
        'lint',
        'injector',
        'wiredep',
        'watch'
    ]);

    // Secure task(s).
    grunt.registerTask('secure', ['env:secure', 'lint', 'concurrent:default']);

    // Lint task(s).
    grunt.registerTask('lint', ['jshint', 'csslint']);

    // Build task(s).
    grunt.registerTask('build', [
        'clean:dist',
        'useminPrepare',
        'concat',
        'ngAnnotate:dist',
        'copy:html',
        'copy:dist',
        'uglify',
        'cssmin',
        'rev',
        'usemin',
        'htmlmin'
    ]);

    // Test task.
    grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);
};

thanks for replying so quickly

Shiti commented 8 years ago

@kgcrom could you please share the code or a create a similar project and share the code so that I can replicate the issue?

kgcrom commented 8 years ago

Sure, I'll create demo project and share. It will be take some time. :grin: Thanks, @Shiti

immortalcy commented 8 years ago

Is there an update regarding this issue? I just download the latest release of the repo, performed npm install, bower install, grunt:

sbt npm install bower install grunt

The project works correctly under development but when I run sbt and then dist:

sbt dist

and try to run the created project I still get the same error:

http://localhost:9000/ui/ Not Found For request 'GET /ui/'

I haven't changed the source code I downloaded at all. Grunt command worked without errors.

UPDATE:

After extracting yo-demo.yo-demo-1.0.0-assets.jar I can see that it doesn't contains the files from ui/app