且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从IntelliJ IDEA部署Java Web应用程序到Heroku

更新时间:2022-10-19 14:39:42

听起来你正在尝试运行 mvn heroku:deploy-war ?您需要添加heroku-maven插件才能工作。以下是指南:
https:/ /devcenter.heroku.com/articles/deploying-java-applications-with-the-heroku-maven-plugin


I hava java web application that run on the web container tomcat. The web app connect to a DB with hibernate framework, and I need to deploy it to heruko from the IntelliJ 14.0.2. so i added the maven framework and this is the pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mastertheboss</groupId>
<artifactId>HibernateExample</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
<name>HibernateExample</name>
<url>http://maven.apache.org</url>

<dependencies>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.0.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.2.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate.common</groupId>
        <artifactId>hibernate-commons-annotations</artifactId>
        <version>4.0.1.Final</version>
        <classifier>tests</classifier>
    </dependency>
    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.0.1.Final</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.4</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.logging</groupId>
        <artifactId>jboss-logging</artifactId>
        <version>3.1.0.CR2</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.6.4</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.10</version>
    </dependency>


</dependencies>

When et the edit configuration of the maven and run it, I get the message: [ERROR] No plugin found for prefix 'heroku' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\User.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]

any idea?

It sounds like you're trying to run mvn heroku:deploy-war? You'll need to add the heroku-maven-plugin for that to work. Here's a guide: https://devcenter.heroku.com/articles/deploying-java-applications-with-the-heroku-maven-plugin