在子项目中运行Gradle任务

时间:2019-11-07 20:06:12

标签: java gradle build continuous-integration

我具有以下项目结构:

    • build.gradle
    • 子项目A
      • build.gradle
    • 子项目B
      • build.gradle

现在,在build.gradle中,子项目A和子项目B都声明了任务 doIt

我正在运行from django.shortcuts import render, get_object_or_404 from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from .models import Post from django.contrib.auth.models import User from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView def home(request): content = { 'posts': Post.objects.all() } return render(request, 'blog/home.html', content) def blog_category(request, category): posts = Post.objects.filter(categories__name__contains=category).order_by('-date_posted') content = { 'category': category, 'posts': posts } return render(request, 'blog/blog_category.html', content) #<--(didn't add content block) bug found 05.11.19 def upload_pic(request): if request.method == 'POST': form = ImageUploadForm(request.POST, request.FILES) if form.is_valid(): m = ExampleModel.objects.get(pk=course_id) m.model_pic = form.cleaned_data['image'] m.save() return HttpResponse('image upload success') return HttpResponseForbidden('allowed only via POST') ... class PostCreateView(LoginRequiredMixin, CreateView): model = Post fields = ['title', 'content', 'categories', 'image'] def form_valid(self, form): form.instance.author = self.request.user return super().form_valid(form) class PostUpdateView(LoginRequiredMixin, UserPassesTestMixin, UpdateView): model = Post fields = ['title', 'content', 'categories', 'image'] def form_valid(self, form): form.instance.author = self.request.user return super().form_valid(form) ,希望子项目A仅运行default。但是,两个gradle :subprojectA:doIt任务(来自subprojectA和subprojectB)都在运行。如果运行doIt,其行为相同。

谁能解释运行任务的实际工作原理?我已经玩了几个小时了,这让我发疯了。

0 个答案:

没有答案